@brightspace-ui/core 2.7.2 → 2.10.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 (32) hide show
  1. package/components/button/button-icon.js +3 -3
  2. package/components/button/floating-buttons.js +1 -1
  3. package/components/card/demo/card.html +1 -1
  4. package/components/colors/colors.js +5 -5
  5. package/components/colors/colors.scss +5 -5
  6. package/components/colors/screenshots/basic-greys.png +0 -0
  7. package/components/dropdown/dropdown-content-styles.js +4 -4
  8. package/components/filter/filter.js +1 -2
  9. package/components/html-block/html-block.js +1 -1
  10. package/components/icons/README.md +1 -1
  11. package/components/icons/icon-styles.js +1 -1
  12. package/components/icons/images/tier2/check-box-unchecked.svg +1 -1
  13. package/components/icons/images/tier2/check-box.svg +1 -1
  14. package/components/inputs/input-select-styles.js +1 -1
  15. package/components/inputs/input-styles.js +1 -1
  16. package/components/inputs/sass/select.scss +1 -1
  17. package/components/inputs/sass/text.scss +1 -1
  18. package/components/list/README.md +2 -3
  19. package/components/list/demo/list-item-layouts.html +0 -56
  20. package/components/list/list-header.js +0 -20
  21. package/components/list/list-item-mixin.js +1 -25
  22. package/components/menu/menu.js +3 -3
  23. package/components/status-indicator/status-indicator.js +3 -3
  24. package/components/tag-list/demo/tag-list.html +28 -3
  25. package/components/tag-list/tag-list-item-mixin.js +31 -16
  26. package/components/tag-list/tag-list-item.js +1 -1
  27. package/components/tag-list/tag-list.js +40 -25
  28. package/custom-elements.json +6 -39
  29. package/generated/icons/tier2/check-box-unchecked.js +1 -1
  30. package/generated/icons/tier2/check-box.js +1 -1
  31. package/package.json +1 -1
  32. package/templates/primary-secondary/primary-secondary.js +1 -1
@@ -60,7 +60,7 @@ class ButtonIcon extends ThemeMixin(ButtonMixin(VisibleOnAncestorMixin(RtlMixin(
60
60
  --d2l-button-icon-min-height: calc(2rem + 2px);
61
61
  --d2l-button-icon-min-width: calc(2rem + 2px);
62
62
  --d2l-button-icon-h-align: calc(((2rem + 2px - 0.9rem) / 2) * -1);
63
- --d2l-icon-fill-color: var(--d2l-button-icon-fill-color, var(--d2l-color-ferrite));
63
+ --d2l-icon-fill-color: var(--d2l-button-icon-fill-color, var(--d2l-color-tungsten));
64
64
  display: inline-block;
65
65
  }
66
66
  :host([hidden]) {
@@ -75,7 +75,7 @@ class ButtonIcon extends ThemeMixin(ButtonMixin(VisibleOnAncestorMixin(RtlMixin(
75
75
  }
76
76
  :host([theme="dark"]) {
77
77
  --d2l-button-icon-background-color: transparent;
78
- --d2l-button-icon-background-color-hover: rgba(51, 53, 54, 0.9); /* ferrite @70% @90% */
78
+ --d2l-button-icon-background-color-hover: rgba(51, 53, 54, 0.9); /* tungsten @70% @90% */
79
79
  --d2l-button-icon-focus-box-shadow: 0 0 0 2px black, 0 0 0 4px var(--d2l-color-celestine-plus-1);
80
80
  --d2l-icon-fill-color: var(--d2l-color-sylvite);
81
81
  --d2l-button-icon-fill-color-hover: var(--d2l-color-sylvite);
@@ -112,7 +112,7 @@ class ButtonIcon extends ThemeMixin(ButtonMixin(VisibleOnAncestorMixin(RtlMixin(
112
112
  button:hover,
113
113
  button:focus,
114
114
  :host([active]) button {
115
- --d2l-icon-fill-color: var(--d2l-button-icon-fill-color-hover, var(--d2l-color-ferrite));
115
+ --d2l-icon-fill-color: var(--d2l-button-icon-fill-color-hover, var(--d2l-color-tungsten));
116
116
  background-color: var(--d2l-button-icon-background-color-hover);
117
117
  }
118
118
  button.focus-visible {
@@ -61,7 +61,7 @@ class FloatingButtons extends RtlMixin(LitElement) {
61
61
  background-color: #ffffff;
62
62
  background-color: rgba(255, 255, 255, 0.88);
63
63
  border-top-color: var(--d2l-color-mica);
64
- box-shadow: 0 -2px 4px rgba(73, 76, 78, 0.2); /* ferrite */
64
+ box-shadow: 0 -2px 4px rgba(32, 33, 34, 0.2); /* ferrite */
65
65
  }
66
66
 
67
67
  :host([_floating]:not([always-float])) .d2l-floating-buttons-container {
@@ -31,7 +31,7 @@
31
31
  }
32
32
  .badge > img {
33
33
  background-color: white;
34
- border: 1px solid #494c4e;
34
+ border: 1px solid #202122; /* ferrite */
35
35
  border-radius: 6px;
36
36
  height: 70px;
37
37
  object-fit: cover;
@@ -8,11 +8,11 @@ if (!document.head.querySelector('#d2l-colors')) {
8
8
  --d2l-color-sylvite: #f1f5fb;
9
9
  --d2l-color-gypsum: #e3e9f1;
10
10
  --d2l-color-mica: #cdd5dc;
11
- --d2l-color-corundum: #b5bdc2;
12
- --d2l-color-chromite: #9ea5a9;
13
- --d2l-color-galena: #868c8f;
14
- --d2l-color-tungsten: #6e7376;
15
- --d2l-color-ferrite: #494c4e;
11
+ --d2l-color-corundum: #b1b9be;
12
+ --d2l-color-chromite: #90989d;
13
+ --d2l-color-galena: #6e7477;
14
+ --d2l-color-tungsten: #494c4e;
15
+ --d2l-color-ferrite: #202122;
16
16
 
17
17
  /* zircon */
18
18
  --d2l-color-zircon-plus-2: #e0feff;
@@ -3,11 +3,11 @@ $d2l-color-regolith: #f9fbff !default;
3
3
  $d2l-color-sylvite: #f1f5fb !default;
4
4
  $d2l-color-gypsum: #e3e9f1 !default;
5
5
  $d2l-color-mica: #cdd5dc !default;
6
- $d2l-color-corundum: #b5bdc2 !default;
7
- $d2l-color-chromite: #9ea5a9 !default;
8
- $d2l-color-galena: #868c8f !default;
9
- $d2l-color-tungsten: #6e7376 !default;
10
- $d2l-color-ferrite: #494c4e !default;
6
+ $d2l-color-corundum: #b1b9be !default;
7
+ $d2l-color-chromite: #90989d !default;
8
+ $d2l-color-galena: #6e7477 !default;
9
+ $d2l-color-tungsten: #494c4e !default;
10
+ $d2l-color-ferrite: #202122 !default;
11
11
 
12
12
  // zircon
13
13
  $d2l-color-zircon-plus-2: #e0feff !default;
@@ -24,8 +24,8 @@ export const dropdownContentStyles = css`
24
24
  :host([theme="dark"]) {
25
25
  --d2l-dropdown-above-animation-name: d2l-dropdown-above-animation-dark;
26
26
  --d2l-dropdown-animation-name: d2l-dropdown-animation-dark;
27
- --d2l-dropdown-background-color: #333536; /* ferrite @ 70% */
28
- --d2l-dropdown-border-color: var(--d2l-color-ferrite);
27
+ --d2l-dropdown-background-color: #333536; /* tungsten @ 70% */
28
+ --d2l-dropdown-border-color: var(--d2l-color-tungsten);
29
29
  --d2l-dropdown-foreground-color: var(--d2l-color-sylvite);
30
30
  --d2l-dropdown-shadow-color: rgba(0, 0, 0, 1);
31
31
  opacity: 0.9;
@@ -66,7 +66,7 @@ export const dropdownContentStyles = css`
66
66
  background-color: var(--d2l-dropdown-background-color);
67
67
  border: 1px solid var(--d2l-dropdown-border-color);
68
68
  border-radius: 0.1rem;
69
- box-shadow: -4px -4px 12px -5px rgba(73, 76, 78, 0.2); /* ferrite */
69
+ box-shadow: -4px -4px 12px -5px rgba(32, 33, 34, 0.2); /* ferrite */
70
70
  height: 16px;
71
71
  -webkit-transform: rotate(45deg);
72
72
  transform: rotate(45deg);
@@ -80,7 +80,7 @@ export const dropdownContentStyles = css`
80
80
  }
81
81
 
82
82
  :host([opened-above]) .d2l-dropdown-content-pointer > div {
83
- box-shadow: 4px 4px 12px -5px rgba(73, 76, 78, 0.2); /* ferrite */
83
+ box-shadow: 4px 4px 12px -5px rgba(32, 33, 34, 0.2); /* ferrite */
84
84
  }
85
85
 
86
86
  :host([no-pointer]) .d2l-dropdown-content-pointer {
@@ -406,8 +406,7 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
406
406
  key="${item.key}"
407
407
  label="${item.text}"
408
408
  selectable
409
- ?selected="${item.selected}"
410
- slim>
409
+ ?selected="${item.selected}">
411
410
  <div class="d2l-filter-dimension-set-value-text d2l-body-compact">${item.text}</div>
412
411
  </d2l-list-item>
413
412
  `)}
@@ -96,7 +96,7 @@ export const htmlBlockContentStyles = css`
96
96
  a:visited,
97
97
  a:link,
98
98
  a:active {
99
- color: var(--d2l-color-ferrite, #494c4e);
99
+ color: var(--d2l-color-ferrite, #202122);
100
100
  }
101
101
  }
102
102
  mjx-assistive-mml math {
@@ -80,7 +80,7 @@ When contributing changes to icons, the SVG files should be properly formatted.
80
80
  - not contain negative values
81
81
  - there should be no `<title>` element
82
82
  - there should be no inline `<style>` -- all style for line fills should be applied directly to the SVG elements
83
- - color of SVG elements should be "ferrite" (`#494c4e`)
83
+ - color of SVG elements should be "tungsten" (`#494c4e`)
84
84
 
85
85
  The best way to have most of these rules applied for you automatically is to put the icon through [SVGOMG](https://jakearchibald.github.io/svgomg/) with these options selected:
86
86
  * `Prettify code` - ON
@@ -5,7 +5,7 @@ export const iconStyles = css`
5
5
  :host {
6
6
  -webkit-align-items: center;
7
7
  align-items: center;
8
- color: var(--d2l-color-ferrite);
8
+ color: var(--d2l-color-tungsten);
9
9
  display: -ms-inline-flexbox;
10
10
  display: -webkit-inline-flex;
11
11
  display: inline-flex;
@@ -1,3 +1,3 @@
1
1
  <svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
2
- <rect fill="#f9fbff" stroke-width="1" stroke="#868c8f" x="0.5" y="0.5" width="23" height="23" rx="5.5"/>
2
+ <rect fill="#f9fbff" stroke-width="1" stroke="#6e7477" x="0.5" y="0.5" width="23" height="23" rx="5.5"/>
3
3
  </svg>
@@ -1,4 +1,4 @@
1
1
  <svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
2
- <rect fill="#f9fbff" stroke-width="1" stroke="#868c8f" x="0.5" y="0.5" width="23" height="23" rx="5.5"/>
2
+ <rect fill="#f9fbff" stroke-width="1" stroke="#6e7477" x="0.5" y="0.5" width="23" height="23" rx="5.5"/>
3
3
  <path fill="#494c4e" d="M19.707,7.293a1,1,0,0,0-1.414,0L10,15.586,6.707,12.293a1,1,0,0,0-1.414,1.414l4,4a1,1,0,0,0,1.414,0l9-9A1,1,0,0,0,19.707,7.293Z"/>
4
4
  </svg>
@@ -33,7 +33,7 @@ export const selectStyles = css`
33
33
  background-color: #ffffff;
34
34
  border-color: var(--d2l-color-galena);
35
35
  border-width: 1px;
36
- box-shadow: inset 0 2px 0 0 rgba(181, 189, 194, 0.2); /* corundum */
36
+ box-shadow: inset 0 2px 0 0 rgba(177, 185, 190, 0.2); /* corundum */
37
37
  padding: 0.4rem 0.75rem;
38
38
  }
39
39
  .d2l-input-select,
@@ -6,7 +6,7 @@ export const inputStyles = css`
6
6
  background-color: var(--d2l-input-background-color, #ffffff);
7
7
  border-radius: var(--d2l-input-border-radius, 0.3rem);
8
8
  border-style: solid;
9
- box-shadow: inset 0 2px 0 0 rgba(181, 189, 194, 0.2); /* corundum */
9
+ box-shadow: inset 0 2px 0 0 rgba(177, 185, 190, 0.2); /* corundum */
10
10
  box-sizing: border-box;
11
11
  color: var(--d2l-color-ferrite);
12
12
  display: inline-block;
@@ -27,7 +27,7 @@
27
27
  background-color: #ffffff;
28
28
  border-color: $d2l-color-galena;
29
29
  border-width: 1px;
30
- box-shadow: inset 0 2px 0 0 rgba(181, 189, 194, .2); /* corundum */
30
+ box-shadow: inset 0 2px 0 0 rgba(177, 185, 190, 0.2); /* corundum */
31
31
  padding: 0.4rem 0.75rem;
32
32
  }
33
33
  &,
@@ -10,7 +10,7 @@
10
10
  border-radius: 0.3rem;
11
11
  border-style: solid;
12
12
  border-width: 1px;
13
- box-shadow: inset 0 2px 0 0 rgba(181, 189, 194, .2), /* corundum */;
13
+ box-shadow: inset 0 2px 0 0 rgba(177, 185, 190, 0.2), /* corundum */;
14
14
  box-sizing: border-box;
15
15
  color: $d2l-color-ferrite;
16
16
  display: inline-block;
@@ -313,7 +313,6 @@ The `d2l-list-header` component can be placed in the `d2l-list`'s `header` slot
313
313
  |---|---|---|
314
314
  | `no-selection` | Boolean | Whether to render select-all and selection summary |
315
315
  | `no-sticky` | Boolean | Disables sticky positioning for the header |
316
- | `padding-type` | String | Header whitespace (`normal` (default), `slim`) |
317
316
  | `select-all-pages-allowed` | Boolean | Whether all pages can be selected |
318
317
  <!-- docs: end hidden content -->
319
318
 
@@ -364,7 +363,7 @@ The `d2l-list-item` provides the appropriate `listitem` semantics for children w
364
363
  | `key` | String | Value to identify item if selectable or draggable |
365
364
  | `label` | String | Explicitly defined label for the element |
366
365
  | `labelled-by` | String | The id of element that provides the label for this element |
367
- | `padding-type` | String | List item whitespace (`normal` (default), `slim`, `none`)|
366
+ | `padding-type` | String | List item whitespace (`normal` (default), `none`)|
368
367
  | `selectable` | Boolean | Indicates an input should be rendered for selecting the item |
369
368
  | `selected` | Boolean | Whether the item is selected |
370
369
  | `skeleton` | Boolean | Renders the input as a skeleton loader |
@@ -436,10 +435,10 @@ The `d2l-list-item-button` provides the same functionality as `d2l-list-item` ex
436
435
  | `key` | String | Value to identify item if selectable or draggable |
437
436
  | `label` | String | Explicitly defined label for the element |
438
437
  | `labelled-by` | String | The id of element that provides the label for this element |
438
+ | `padding-type` | String | List item whitespace (`normal` (default), `none`)|
439
439
  | `selectable` | Boolean | Indicates an input should be rendered for selecting the item |
440
440
  | `selected` | Boolean | Whether the item is selected |
441
441
  | `skeleton` | Boolean | Renders the input as a skeleton loader |
442
- | `slim` | Boolean | Whether to render the list-item with reduced whitespace|
443
442
 
444
443
  ### Events
445
444
 
@@ -17,11 +17,6 @@
17
17
  height: 500px;
18
18
  object-fit: cover;
19
19
  }
20
- d2l-list-item[slim] div {
21
- overflow: hidden;
22
- text-overflow: ellipsis;
23
- white-space: nowrap;
24
- }
25
20
  </style>
26
21
  </head>
27
22
  <body unresolved>
@@ -58,30 +53,6 @@
58
53
  </template>
59
54
  </d2l-demo-snippet>
60
55
 
61
- <h2>Slim</h2>
62
-
63
- <d2l-demo-snippet>
64
- <template>
65
- <d2l-list>
66
- <d2l-list-item slim>
67
- <d2l-list-item-content>
68
- <div>Identify categories of physical activities</div>
69
- </d2l-list-item-content>
70
- </d2l-list-item>
71
- <d2l-list-item slim>
72
- <d2l-list-item-content>
73
- <div>Apply a decision-making process to assess risks and make safe decisions in a variety of situations</div>
74
- </d2l-list-item-content>
75
- </d2l-list-item>
76
- <d2l-list-item slim>
77
- <d2l-list-item-content>
78
- <div>Retain objects of various shapes and sizes in different ways, while moving around others and equipment</div>
79
- </d2l-list-item-content>
80
- </d2l-list-item>
81
- </d2l-list>
82
- </template>
83
- </d2l-demo-snippet>
84
-
85
56
  <h2>Separators: between</h2>
86
57
 
87
58
  <d2l-demo-snippet>
@@ -301,33 +272,6 @@
301
272
  </template>
302
273
  </d2l-demo-snippet>
303
274
 
304
- <h2>Selectable, Slim, Extended Separators</h2>
305
-
306
- <d2l-demo-snippet>
307
- <template>
308
- <d2l-list extend-separators>
309
- <d2l-list-item slim selectable key="1" label="Introductory Earth Sciences">
310
- <d2l-list-item-content>
311
- <div>Introductory Earth Sciences</div>
312
- <div slot="supporting-info">This course explores the geological process of the Earth's interior and surface. These include volcanism, earthquakes, mountains...</div>
313
- </d2l-list-item-content>
314
- </d2l-list-item>
315
- <d2l-list-item slim selectable key="2" selected label="Engineering Materials for Energy Systems">
316
- <d2l-list-item-content>
317
- <div>Engineering Materials for Energy Systems</div>
318
- <div slot="supporting-info">This course explores the geological processes of the Earth's interior and surface. These include volcanism, earthquakes, mountain...</div>
319
- </d2l-list-item-content>
320
- </d2l-list-item>
321
- <d2l-list-item slim selectable key="3" label="Geomorphology and GIS">
322
- <d2l-list-item-content>
323
- <div>Geomorphology and GIS </div>
324
- <div slot="supporting-info">This course explores the geological processes of the Earth's interior and surface. These include volcanism, earthquakes, mountain...</div>
325
- </d2l-list-item-content>
326
- </d2l-list-item>
327
- </d2l-list>
328
- </template>
329
- </d2l-demo-snippet>
330
-
331
275
  </d2l-demo-page>
332
276
 
333
277
  </body>
@@ -26,23 +26,11 @@ class ListHeader extends RtlMixin(LocalizeCoreElement(LitElement)) {
26
26
  * @type {boolean}
27
27
  */
28
28
  noSticky: { type: Boolean, attribute: 'no-sticky' },
29
- /**
30
- * How much padding to render list items with
31
- * @type {'normal'|'slim'}
32
- */
33
- paddingType: { type: String, attribute: 'padding-type' },
34
29
  /**
35
30
  * Whether all pages can be selected
36
31
  * @type {boolean}
37
32
  */
38
33
  selectAllPagesAllowed: { type: Boolean, attribute: 'select-all-pages-allowed' },
39
- /**
40
- * @ignore
41
- * Whether to render a header with reduced whitespace
42
- * TODO: Remove
43
- * @type {boolean}
44
- */
45
- slim: { reflect: true, type: Boolean },
46
34
  _scrolled: { type: Boolean, reflect: true }
47
35
  };
48
36
  }
@@ -81,12 +69,6 @@ class ListHeader extends RtlMixin(LocalizeCoreElement(LitElement)) {
81
69
  display: flex;
82
70
  margin-bottom: 6px;
83
71
  margin-top: 6px;
84
- min-height: 58px;
85
- }
86
- :host([slim]) .d2l-list-header-container { /* TODO: Remove */
87
- min-height: 36px;
88
- }
89
- :host([padding-type="slim"]) .d2l-list-header-container {
90
72
  min-height: 36px;
91
73
  }
92
74
  .d2l-list-header-extend-separator {
@@ -126,9 +108,7 @@ class ListHeader extends RtlMixin(LocalizeCoreElement(LitElement)) {
126
108
  super();
127
109
  this.noSelection = false;
128
110
  this.noSticky = false;
129
- this.paddingType = 'normal';
130
111
  this.selectAllPagesAllowed = false;
131
- this.slim = false;
132
112
  this._extendSeparator = false;
133
113
  }
134
114
 
@@ -59,16 +59,9 @@ export const ListItemMixin = superclass => class extends LocalizeCoreElement(Lis
59
59
  dragTargetHandleOnly: { type: Boolean, attribute: 'drag-target-handle-only' },
60
60
  /**
61
61
  * How much padding to render list items with
62
- * @type {'normal'|'slim'|'none'}
62
+ * @type {'normal'|'none'}
63
63
  */
64
64
  paddingType: { type: String, attribute: 'padding-type' },
65
- /**
66
- * @ignore
67
- * Whether to render the list-item with reduced whitespace.
68
- * TODO: Remove in favor of padding-type="slim"
69
- * @type {boolean}
70
- */
71
- slim: { type: Boolean },
72
65
  _breakpoint: { type: Number },
73
66
  _displayKeyboardTooltip: { type: Boolean },
74
67
  _dropdownOpen: { type: Boolean, attribute: '_dropdown-open', reflect: true },
@@ -182,14 +175,6 @@ export const ListItemMixin = superclass => class extends LocalizeCoreElement(Lis
182
175
  padding-left: 0.55rem;
183
176
  padding-right: 0;
184
177
  }
185
- :host([slim]) [slot="content"] { /* TODO, remove */
186
- padding-bottom: 0.4rem;
187
- padding-top: 0.4rem;
188
- }
189
- :host([padding-type="slim"]) [slot="content"] {
190
- padding-bottom: 0.4rem;
191
- padding-top: 0.4rem;
192
- }
193
178
  :host([padding-type="none"]) [slot="content"] {
194
179
  padding-bottom: 0;
195
180
  padding-top: 0;
@@ -277,14 +262,6 @@ export const ListItemMixin = superclass => class extends LocalizeCoreElement(Lis
277
262
  .d2l-list-item-content-extend-separators d2l-selection-input {
278
263
  margin-left: 0.9rem;
279
264
  }
280
- :host([slim]) d2l-selection-input { /* TODO, remove */
281
- margin-bottom: 0.4rem;
282
- margin-top: 0.4rem;
283
- }
284
- :host([padding-type="slim"]) d2l-selection-input {
285
- margin-bottom: 0.4rem;
286
- margin-top: 0.4rem;
287
- }
288
265
  d2l-list-item-drag-handle {
289
266
  margin: 0.25rem 0 0.25rem 0.4rem;
290
267
  }
@@ -366,7 +343,6 @@ export const ListItemMixin = superclass => class extends LocalizeCoreElement(Lis
366
343
  constructor() {
367
344
  super();
368
345
  this.breakpoints = defaultBreakpoints;
369
- this.slim = false;
370
346
  this.paddingType = 'normal';
371
347
  this._breakpoint = 0;
372
348
  this._contentId = getUniqueId();
@@ -65,12 +65,12 @@ class Menu extends ThemeMixin(HierarchicalViewMixin(LitElement)) {
65
65
  }
66
66
 
67
67
  :host([theme="dark"]) {
68
- --d2l-menu-background-color: #333536; /* ferrite @ 70% */
68
+ --d2l-menu-background-color: #333536; /* tungsten @ 70% */
69
69
  --d2l-menu-background-color-hover: #123559; /* celestine-1 @ 50% */
70
- --d2l-menu-border-color: var(--d2l-color-ferrite);
70
+ --d2l-menu-border-color: var(--d2l-color-tungsten);
71
71
  --d2l-menu-foreground-color: var(--d2l-color-sylvite);
72
72
  --d2l-menu-foreground-color-hover: #ffffff;
73
- --d2l-menu-separator-color: var(--d2l-color-tungsten);
73
+ --d2l-menu-separator-color: var(--d2l-color-galena);
74
74
  --d2l-icon-fill-color: var(--d2l-color-mica);
75
75
  background-color: var(--d2l-menu-background-color); /* so that opacity on disabled items works */
76
76
  }
@@ -68,8 +68,8 @@ class StatusIndicator extends LitElement {
68
68
  }
69
69
  :host([state="none"]),
70
70
  :host([state="null"]) {
71
- border-color: var(--d2l-color-ferrite);
72
- color: var(--d2l-color-ferrite);
71
+ border-color: var(--d2l-color-tungsten);
72
+ color: var(--d2l-color-tungsten);
73
73
  }
74
74
 
75
75
  :host([bold]) {
@@ -84,7 +84,7 @@ class StatusIndicator extends LitElement {
84
84
  }
85
85
  :host([bold][state="none"]),
86
86
  :host([bold][state="null"]) {
87
- background-color: var(--d2l-color-ferrite);
87
+ background-color: var(--d2l-color-tungsten);
88
88
  }
89
89
  `;
90
90
  }
@@ -10,23 +10,48 @@
10
10
  import '../tag-list-item.js';
11
11
  import '../test/tag-list-item-mixin-consumer.js';
12
12
  </script>
13
+ <style>
14
+ .actions {
15
+ margin-bottom: 1rem;
16
+ }
17
+ </style>
13
18
  </head>
14
19
  <body unresolved>
15
20
  <d2l-demo-page page-title="d2l-tag-list">
16
21
 
17
22
  <h2>Basic Tag List</h2>
23
+
24
+ <div class="actions">
25
+ <button id="add">add tag (first)</button>
26
+ <button id="remove">remove tag (first)</button>
27
+ </div>
28
+ <script>
29
+ let addIndex = 0;
30
+ document.querySelector('#add').addEventListener('click', () => {
31
+ const tag = document.createElement('d2l-tag-list-item');
32
+ tag.text = `Added Tag ${++addIndex}`;
33
+ document.querySelector('d2l-tag-list').insertBefore(tag, document.querySelector('d2l-tag-list').children[0]);
34
+ });
35
+
36
+ document.querySelector('#remove').addEventListener('click', () => {
37
+ const children = document.querySelector('d2l-tag-list').children;
38
+ if (children.length === 0) return;
39
+ document.querySelector('d2l-tag-list').removeChild(children[0]);
40
+ });
41
+
42
+ </script>
18
43
  <d2l-demo-snippet fullscreen>
19
44
  <d2l-tag-list description="A bunch of example tags">
20
45
  <d2l-tag-list-item text="Example Tag"></d2l-tag-list-item>
21
- <d2l-tag-list-item text="Longer Example Tag - much much much much much longer"></d2l-tag-list-item>
46
+ <d2l-tag-list-item text="Longer Example Tag - much much much much much much much much longer"></d2l-tag-list-item>
22
47
  <d2l-tag-list-item text="Another Example Tag"></d2l-tag-list-item>
23
48
  <d2l-tag-list-item-mixin-consumer name="Custom Tag List Item"></d2l-tag-list-item-mixin-consumer>
24
49
  <d2l-tag-list-item text="Example Tag 5"></d2l-tag-list-item>
25
50
  <d2l-tag-list-item text="Example Tag 6"></d2l-tag-list-item>
26
51
  <d2l-tag-list-item text="Example Tag 7"></d2l-tag-list-item>
27
- </d2l-tag-list>
52
+ </d2l-tag-list>
28
53
  </d2l-demo-snippet>
29
54
 
30
55
  </d2l-demo-page>
31
56
  </body>
32
- </html>
57
+ </html>
@@ -1,5 +1,7 @@
1
1
  import '../colors/colors.js';
2
+ import '../tooltip/tooltip.js';
2
3
  import { css, html } from 'lit';
4
+ import { getUniqueId } from '../../helpers/uniqueId.js';
3
5
  import { labelStyles } from '../typography/styles.js';
4
6
 
5
7
  export const TagListItemMixin = superclass => class extends superclass {
@@ -17,19 +19,12 @@ export const TagListItemMixin = superclass => class extends superclass {
17
19
  return [labelStyles, css`
18
20
  :host {
19
21
  display: grid;
22
+ max-width: 100%;
20
23
  outline: none;
21
24
  }
22
25
  :host([hidden]) {
23
26
  display: none;
24
27
  }
25
- .tag-list-item-content {
26
- height: 1rem;
27
- margin: auto;
28
- min-width: 0;
29
- overflow: hidden;
30
- text-overflow: ellipsis;
31
- white-space: nowrap;
32
- }
33
28
  .tag-list-item-container {
34
29
  background-color: var(--d2l-color-regolith);
35
30
  border-radius: 6px;
@@ -37,21 +32,26 @@ export const TagListItemMixin = superclass => class extends superclass {
37
32
  box-sizing: border-box;
38
33
  color: var(--d2l-color-ferrite);
39
34
  cursor: pointer;
40
- display: flex;
35
+ max-width: 320px;
41
36
  min-width: 0;
37
+ outline: none;
38
+ overflow: hidden;
42
39
  padding: 0.25rem 0.6rem;
40
+ text-overflow: ellipsis;
43
41
  transition: background-color 0.2s ease-out, box-shadow 0.2s ease-out;
42
+ white-space: nowrap;
43
+ }
44
+ .tag-list-item-container:focus,
45
+ :host(:hover) .tag-list-item-container:focus {
46
+ box-shadow: inset 0 0 0 2px var(--d2l-color-celestine), 0 2px 4px rgba(0, 0, 0, 0.03);
44
47
  }
45
48
  :host(:hover) .tag-list-item-container,
46
- :host(:focus) .tag-list-item-container {
49
+ .tag-list-item-container:focus {
47
50
  background-color: var(--d2l-color-sylvite);
48
51
  }
49
52
  :host(:hover) .tag-list-item-container {
50
53
  box-shadow: inset 0 0 0 1px var(--d2l-color-mica), 0 2px 4px rgba(0, 0, 0, 0.03);
51
54
  }
52
- :host(:focus) .tag-list-item-container {
53
- box-shadow: inset 0 0 0 2px var(--d2l-color-celestine), 0 2px 4px rgba(0, 0, 0, 0.03);
54
- }
55
55
 
56
56
  @media (prefers-reduced-motion: reduce) {
57
57
  .tag-list-item-container {
@@ -65,12 +65,27 @@ export const TagListItemMixin = superclass => class extends superclass {
65
65
  super();
66
66
  /** @ignore */
67
67
  this.role = 'listitem';
68
+ this._id = getUniqueId();
69
+ }
70
+
71
+ firstUpdated(changedProperties) {
72
+ super.firstUpdated(changedProperties);
73
+
74
+ const container = this.shadowRoot.querySelector('.tag-list-item-container');
75
+ this.addEventListener('focus', () => container.focus());
76
+ this.addEventListener('blur', () => container.blur());
68
77
  }
69
78
 
70
- _renderTag(tagContent) {
79
+ _renderTag(tagContent, hasTruncationTooltip) {
80
+ const tooltip = hasTruncationTooltip ? html`
81
+ <d2l-tooltip for="${this._id}" show-truncated-only>
82
+ ${tagContent}
83
+ </d2l-tooltip>
84
+ ` : null;
71
85
  return html`
72
- <div class="tag-list-item-container d2l-label-text">
73
- <div class="tag-list-item-content">${tagContent}</div>
86
+ ${tooltip}
87
+ <div class="tag-list-item-container d2l-label-text" id="${this._id}" tabindex="-1">
88
+ ${tagContent}
74
89
  </div>
75
90
  `;
76
91
  }
@@ -14,7 +14,7 @@ class TagListItem extends TagListItemMixin(LitElement) {
14
14
  }
15
15
 
16
16
  render() {
17
- return this._renderTag(this.text);
17
+ return this._renderTag(this.text, true);
18
18
  }
19
19
  }
20
20
 
@@ -14,7 +14,7 @@ const PAGE_SIZE_LINES = {
14
14
  medium: 2,
15
15
  small: 3
16
16
  };
17
- const MARGIN_TOP_HEIGHT = 6;
17
+ const MARGIN_TOP_RIGHT = 6;
18
18
 
19
19
  class TagList extends LocalizeCoreElement(ArrowKeysMixin(LitElement)) {
20
20
 
@@ -44,7 +44,6 @@ class TagList extends LocalizeCoreElement(ArrowKeysMixin(LitElement)) {
44
44
  flex-wrap: wrap;
45
45
  margin: -6px -6px 0 0;
46
46
  padding: 0;
47
- position: relative;
48
47
  }
49
48
  ::slotted(*),
50
49
  d2l-button-subtle {
@@ -65,7 +64,7 @@ class TagList extends LocalizeCoreElement(ArrowKeysMixin(LitElement)) {
65
64
  /** @ignore */
66
65
  this.arrowKeysDirection = 'leftrightupdown';
67
66
  this._chompIndex = 10000;
68
- this._items = [];
67
+ this._hasResized = false;
69
68
  this._resizeObserver = null;
70
69
  this._showHiddenTags = false;
71
70
  }
@@ -73,11 +72,18 @@ class TagList extends LocalizeCoreElement(ArrowKeysMixin(LitElement)) {
73
72
  disconnectedCallback() {
74
73
  super.disconnectedCallback();
75
74
  if (this._resizeObserver) this._resizeObserver.disconnect();
75
+ if (this._subtleButtonResizeObserver) this._subtleButtonResizeObserver.disconnect();
76
76
  }
77
77
 
78
78
  firstUpdated(changedProperties) {
79
79
  super.firstUpdated(changedProperties);
80
80
 
81
+ const subtleButton = this.shadowRoot.querySelector('.d2l-tag-list-hidden-button');
82
+ this._subtleButtonResizeObserver = new ResizeObserver(() => {
83
+ this._subtleButtonWidth = Math.ceil(parseFloat(getComputedStyle(subtleButton).getPropertyValue('width')));
84
+ });
85
+ this._subtleButtonResizeObserver.observe(subtleButton);
86
+
81
87
  const container = this.shadowRoot.querySelector('.tag-list-outer-container');
82
88
  this._resizeObserver = new ResizeObserver((e) => requestAnimationFrame(() => this._handleResize(e)));
83
89
  this._resizeObserver.observe(container);
@@ -86,15 +92,17 @@ class TagList extends LocalizeCoreElement(ArrowKeysMixin(LitElement)) {
86
92
  render() {
87
93
  let hiddenCount = 0;
88
94
  let hasHiddenTags = false;
89
- this._items.forEach((element, index) => {
90
- if (index >= this._chompIndex) hasHiddenTags = true;
91
- if (!this._showHiddenTags && index >= this._chompIndex) {
92
- hiddenCount++;
93
- element.setAttribute('data-is-chomped', '');
94
- } else {
95
- element.removeAttribute('data-is-chomped');
96
- }
97
- });
95
+ if (this._items) {
96
+ this._items.forEach((element, index) => {
97
+ if (index >= this._chompIndex) hasHiddenTags = true;
98
+ if (!this._showHiddenTags && index >= this._chompIndex) {
99
+ hiddenCount++;
100
+ element.setAttribute('data-is-chomped', '');
101
+ } else {
102
+ element.removeAttribute('data-is-chomped');
103
+ }
104
+ });
105
+ }
98
106
 
99
107
  let button = null;
100
108
  if (hasHiddenTags) {
@@ -123,7 +131,7 @@ class TagList extends LocalizeCoreElement(ArrowKeysMixin(LitElement)) {
123
131
  `;
124
132
 
125
133
  const outerContainerStyles = {
126
- maxHeight: (this._showHiddenTags || !this._lines) ? undefined : `${(this._itemHeight + MARGIN_TOP_HEIGHT) * this._lines}px`
134
+ maxHeight: (this._showHiddenTags || !this._lines) ? undefined : `${(this._itemHeight + MARGIN_TOP_RIGHT) * this._lines}px`
127
135
  };
128
136
 
129
137
  return html`
@@ -140,15 +148,12 @@ class TagList extends LocalizeCoreElement(ArrowKeysMixin(LitElement)) {
140
148
  }
141
149
 
142
150
  focus() {
143
- if (this._items.length > 0) this._items[0].focus();
151
+ if (this._items && this._items.length > 0) this._items[0].focus();
144
152
  }
145
153
 
146
154
  _chomp() {
147
155
  if (!this.shadowRoot || !this._lines || !this._itemLayouts) return;
148
156
 
149
- const subtleButton = this.shadowRoot.querySelector('.d2l-tag-list-hidden-button');
150
- const subtleButtonWidth = Math.ceil(parseFloat(getComputedStyle(subtleButton).getPropertyValue('width')));
151
-
152
157
  const showing = {
153
158
  count: 0,
154
159
  width: 0
@@ -166,9 +171,10 @@ class TagList extends LocalizeCoreElement(ArrowKeysMixin(LitElement)) {
166
171
 
167
172
  for (let i = overflowingIndex; i < this._itemLayouts.length; i++) {
168
173
  const itemLayout = this._itemLayouts[i];
174
+ const itemWidth = Math.min(itemLayout.width, this._availableWidth);
169
175
 
170
- if (!isOverflowing && showing.width + itemLayout.width < this._availableWidth) {
171
- showing.width += itemLayout.width;
176
+ if (!isOverflowing && ((showing.width + itemWidth) <= (this._availableWidth + MARGIN_TOP_RIGHT))) {
177
+ showing.width += itemWidth;
172
178
  showing.count += 1;
173
179
  itemLayout.trigger = 'soft-show';
174
180
  } else if (k < this._lines) {
@@ -179,7 +185,6 @@ class TagList extends LocalizeCoreElement(ArrowKeysMixin(LitElement)) {
179
185
  itemLayout.trigger = 'soft-hide';
180
186
  }
181
187
  }
182
-
183
188
  }
184
189
 
185
190
  if (!isOverflowing) {
@@ -189,7 +194,7 @@ class TagList extends LocalizeCoreElement(ArrowKeysMixin(LitElement)) {
189
194
 
190
195
  // calculate if additional item(s) should be hidden due to subtle button needing space
191
196
  for (let j = this._itemLayouts.length; j--;) {
192
- if ((showing.width + subtleButtonWidth) < this._availableWidth) {
197
+ if ((showing.width + this._subtleButtonWidth) < this._availableWidth) {
193
198
  break;
194
199
  }
195
200
  const itemLayoutOverflowing = this._itemLayouts[j];
@@ -223,29 +228,39 @@ class TagList extends LocalizeCoreElement(ArrowKeysMixin(LitElement)) {
223
228
  return slot.assignedNodes({ flatten: true }).filter((node) => {
224
229
  if (node.nodeType !== Node.ELEMENT_NODE) return false;
225
230
  const role = node.getAttribute('role');
231
+ node.removeAttribute('data-is-chomped');
226
232
  return (role === 'listitem');
227
233
  });
228
234
  }
229
235
 
230
236
  _handleResize(entries) {
231
- this._availableWidth = Math.ceil(entries[0].contentRect.width);
237
+ this._availableWidth = Math.floor(entries[0].contentRect.width);
232
238
  if (this._availableWidth >= PAGE_SIZE.large) this._lines = PAGE_SIZE_LINES.large;
233
239
  else if (this._availableWidth < PAGE_SIZE.large && this._availableWidth >= PAGE_SIZE.medium) this._lines = PAGE_SIZE_LINES.medium;
234
240
  else this._lines = PAGE_SIZE_LINES.small;
241
+ if (!this._hasResized) {
242
+ this._hasResized = true;
243
+ this._handleSlotChange();
244
+ }
235
245
  this._chomp();
236
246
  }
237
247
 
238
248
  _handleSlotChange() {
239
- requestAnimationFrame(() => {
249
+ if (!this._hasResized) return;
250
+
251
+ requestAnimationFrame(async() => {
240
252
  this._items = this._getTagListItems();
241
- this._itemLayouts = this._getItemLayouts(this._items);
253
+ if (!this._items || this._items.length === 0) return;
242
254
 
243
- if (this._items.length === 0) return;
255
+ await Promise.all(this._items.map(item => item.updateComplete));
256
+
257
+ this._itemLayouts = this._getItemLayouts(this._items);
244
258
  this._itemHeight = this._items[0].offsetHeight;
245
259
  this._items.forEach((item, index) => {
246
260
  item.setAttribute('tabIndex', index === 0 ? 0 : -1);
247
261
  });
248
262
  this._chomp();
263
+ this.requestUpdate();
249
264
  });
250
265
  }
251
266
 
@@ -6510,7 +6510,7 @@
6510
6510
  {
6511
6511
  "name": "padding-type",
6512
6512
  "description": "How much padding to render list items with",
6513
- "type": "'normal'|'slim'|'none'",
6513
+ "type": "'normal'|'none'",
6514
6514
  "default": "\"normal\""
6515
6515
  },
6516
6516
  {
@@ -6589,16 +6589,11 @@
6589
6589
  "type": "array",
6590
6590
  "default": "[842,636,580,0]"
6591
6591
  },
6592
- {
6593
- "name": "slim",
6594
- "type": "boolean",
6595
- "default": "false"
6596
- },
6597
6592
  {
6598
6593
  "name": "paddingType",
6599
6594
  "attribute": "padding-type",
6600
6595
  "description": "How much padding to render list items with",
6601
- "type": "'normal'|'slim'|'none'",
6596
+ "type": "'normal'|'none'",
6602
6597
  "default": "\"normal\""
6603
6598
  },
6604
6599
  {
@@ -6710,12 +6705,6 @@
6710
6705
  "type": "boolean",
6711
6706
  "default": "false"
6712
6707
  },
6713
- {
6714
- "name": "padding-type",
6715
- "description": "How much padding to render list items with",
6716
- "type": "'normal'|'slim'",
6717
- "default": "\"normal\""
6718
- },
6719
6708
  {
6720
6709
  "name": "select-all-pages-allowed",
6721
6710
  "description": "Whether all pages can be selected",
@@ -6738,24 +6727,12 @@
6738
6727
  "type": "boolean",
6739
6728
  "default": "false"
6740
6729
  },
6741
- {
6742
- "name": "paddingType",
6743
- "attribute": "padding-type",
6744
- "description": "How much padding to render list items with",
6745
- "type": "'normal'|'slim'",
6746
- "default": "\"normal\""
6747
- },
6748
6730
  {
6749
6731
  "name": "selectAllPagesAllowed",
6750
6732
  "attribute": "select-all-pages-allowed",
6751
6733
  "description": "Whether all pages can be selected",
6752
6734
  "type": "boolean",
6753
6735
  "default": "false"
6754
- },
6755
- {
6756
- "name": "slim",
6757
- "type": "boolean",
6758
- "default": "false"
6759
6736
  }
6760
6737
  ],
6761
6738
  "slots": [
@@ -6784,7 +6761,7 @@
6784
6761
  {
6785
6762
  "name": "padding-type",
6786
6763
  "description": "How much padding to render list items with",
6787
- "type": "'normal'|'slim'|'none'",
6764
+ "type": "'normal'|'none'",
6788
6765
  "default": "\"normal\""
6789
6766
  },
6790
6767
  {
@@ -6863,16 +6840,11 @@
6863
6840
  "type": "array",
6864
6841
  "default": "[842,636,580,0]"
6865
6842
  },
6866
- {
6867
- "name": "slim",
6868
- "type": "boolean",
6869
- "default": "false"
6870
- },
6871
6843
  {
6872
6844
  "name": "paddingType",
6873
6845
  "attribute": "padding-type",
6874
6846
  "description": "How much padding to render list items with",
6875
- "type": "'normal'|'slim'|'none'",
6847
+ "type": "'normal'|'none'",
6876
6848
  "default": "\"normal\""
6877
6849
  },
6878
6850
  {
@@ -7183,7 +7155,7 @@
7183
7155
  {
7184
7156
  "name": "padding-type",
7185
7157
  "description": "How much padding to render list items with",
7186
- "type": "'normal'|'slim'|'none'",
7158
+ "type": "'normal'|'none'",
7187
7159
  "default": "\"normal\""
7188
7160
  },
7189
7161
  {
@@ -7274,16 +7246,11 @@
7274
7246
  "type": "array",
7275
7247
  "default": "[842,636,580,0]"
7276
7248
  },
7277
- {
7278
- "name": "slim",
7279
- "type": "boolean",
7280
- "default": "false"
7281
- },
7282
7249
  {
7283
7250
  "name": "paddingType",
7284
7251
  "attribute": "padding-type",
7285
7252
  "description": "How much padding to render list items with",
7286
- "type": "'normal'|'slim'|'none'",
7253
+ "type": "'normal'|'none'",
7287
7254
  "default": "\"normal\""
7288
7255
  },
7289
7256
  {
@@ -1,5 +1,5 @@
1
1
  // auto-generated
2
2
  export const val = `<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
3
- <rect fill="#f9fbff" stroke-width="1" stroke="#868c8f" x="0.5" y="0.5" width="23" height="23" rx="5.5"/>
3
+ <rect fill="#f9fbff" stroke-width="1" stroke="#6e7477" x="0.5" y="0.5" width="23" height="23" rx="5.5"/>
4
4
  </svg>
5
5
  `;
@@ -1,6 +1,6 @@
1
1
  // auto-generated
2
2
  export const val = `<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
3
- <rect fill="#f9fbff" stroke-width="1" stroke="#868c8f" x="0.5" y="0.5" width="23" height="23" rx="5.5"/>
3
+ <rect fill="#f9fbff" stroke-width="1" stroke="#6e7477" x="0.5" y="0.5" width="23" height="23" rx="5.5"/>
4
4
  <path fill="#494c4e" d="M19.707,7.293a1,1,0,0,0-1.414,0L10,15.586,6.707,12.293a1,1,0,0,0-1.414,1.414l4,4a1,1,0,0,0,1.414,0l9-9A1,1,0,0,0,19.707,7.293Z"/>
5
5
  </svg>
6
6
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.7.2",
3
+ "version": "2.10.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",
@@ -674,7 +674,7 @@ class TemplatePrimarySecondary extends FocusVisiblePolyfillMixin(RtlMixin(Locali
674
674
 
675
675
  footer {
676
676
  background-color: white;
677
- box-shadow: 0 -2px 4px rgba(73, 76, 78, 0.2); /* ferrite */
677
+ box-shadow: 0 -2px 4px rgba(32, 33, 34, 0.2); /* ferrite */
678
678
  padding: 0.75rem 1rem;
679
679
  z-index: 1; /* ensures the footer box-shadow is over main areas with background colours set */
680
680
  }