@brightspace-ui/core 1.225.0 → 1.227.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.
@@ -83,6 +83,12 @@ The `d2l-dialog` element is a generic dialog that provides a slot for arbitrary
83
83
  - `d2l-dialog-close`: dispatched with the action value when the dialog is closed for any reason
84
84
  <!-- docs: end hidden content -->
85
85
 
86
+ ### Accessibility Properties
87
+
88
+ | Attribute | Description |
89
+ |--|--|
90
+ | `describe-content` | When set, screen readers will announce the contents when opened. |
91
+
86
92
  ### Methods
87
93
 
88
94
  - `resize`: resizes the dialog based on specified `width` and measured content height
@@ -8,6 +8,7 @@ import { DialogMixin } from './dialog-mixin.js';
8
8
  import { dialogStyles } from './dialog-styles.js';
9
9
  import { getUniqueId } from '../../helpers/uniqueId.js';
10
10
  import { heading3Styles } from '../typography/styles.js';
11
+ import { ifDefined } from 'lit-html/directives/if-defined.js';
11
12
  import { LocalizeCoreElement } from '../../lang/localize-core-element.js';
12
13
  import { styleMap } from 'lit-html/directives/style-map.js';
13
14
 
@@ -27,6 +28,11 @@ class Dialog extends LocalizeCoreElement(AsyncContainerMixin(DialogMixin(LitElem
27
28
  */
28
29
  async: { type: Boolean },
29
30
 
31
+ /**
32
+ * Whether to read the contents of the dialog on open
33
+ */
34
+ describeContent: { type: Boolean, attribute: 'describe-content' },
35
+
30
36
  /**
31
37
  * The preferred width (unit-less) for the dialog
32
38
  */
@@ -100,6 +106,7 @@ class Dialog extends LocalizeCoreElement(AsyncContainerMixin(DialogMixin(LitElem
100
106
  constructor() {
101
107
  super();
102
108
  this.async = false;
109
+ this.describeContent = false;
103
110
  this.width = 600;
104
111
  this._handleResize = this._handleResize.bind(this);
105
112
  this._handleResize();
@@ -151,9 +158,10 @@ class Dialog extends LocalizeCoreElement(AsyncContainerMixin(DialogMixin(LitElem
151
158
  'd2l-footer-no-content': !this._hasFooterContent
152
159
  };
153
160
 
161
+ if (!this._textId && this.describeContent) this._textId = getUniqueId();
154
162
  const content = html`
155
163
  ${loading}
156
- <div style=${styleMap(slotStyles)}><slot></slot></div>
164
+ <div id="${ifDefined(this._textId)}" style=${styleMap(slotStyles)}><slot></slot></div>
157
165
  `;
158
166
 
159
167
  if (!this._titleId) this._titleId = getUniqueId();
@@ -171,9 +179,11 @@ class Dialog extends LocalizeCoreElement(AsyncContainerMixin(DialogMixin(LitElem
171
179
  </div>
172
180
  </div>
173
181
  `;
182
+
183
+ const descId = (this.describeContent) ? this._textId : undefined;
174
184
  return this._render(
175
185
  inner,
176
- { labelId: this._titleId, role: 'dialog' },
186
+ { labelId: this._titleId, descId: descId, role: 'dialog' },
177
187
  topOverride
178
188
  );
179
189
  }
@@ -110,11 +110,12 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
110
110
  updated(changedProperties) {
111
111
  super.updated(changedProperties);
112
112
  if (!this.openOnHover || !changedProperties.has('_isFading')) return;
113
-
113
+ const element = this.__getContentElement();
114
+ if (!element) return;
114
115
  if (this._isFading) {
115
- this.__getContentElement()?.classList.add('d2l-dropdown-content-fading');
116
+ element.classList.add('d2l-dropdown-content-fading');
116
117
  } else {
117
- this.__getContentElement()?.classList.remove('d2l-dropdown-content-fading');
118
+ element.classList.remove('d2l-dropdown-content-fading');
118
119
  }
119
120
  }
120
121
 
@@ -254,7 +255,9 @@ export const DropdownOpenerMixin = superclass => class extends superclass {
254
255
  if (this.noAutoOpen) return;
255
256
  if (this.openOnHover) {
256
257
  // prevent propogation to window and triggering _onOutsideClick
257
- e?.stopPropagation();
258
+ if (e) {
259
+ e.stopPropagation();
260
+ }
258
261
  this._closeTimerStop();
259
262
  if (this._isOpen && !this._isHovering) {
260
263
  this.closeDropdown();
@@ -311,7 +311,7 @@ The `d2l-list-header` component can be placed in the `d2l-list`'s `header` slot
311
311
 
312
312
  | Property | Type | Description |
313
313
  |---|---|---|
314
- | `slim` | Boolean | Whether to render a header with reduced whitespace |
314
+ | `padding-type` | String | Header whitespace (`normal` (default), `slim`)|
315
315
  <!-- docs: end hidden content -->
316
316
 
317
317
  ## List Item [d2l-list-item]
@@ -354,16 +354,17 @@ The `d2l-list-item` provides the appropriate `listitem` semantics for children w
354
354
  | `disabled` | Boolean | Disables the input |
355
355
  | `draggable` | Boolean | Whether the item is draggable |
356
356
  | `drag-handle-text` | String | 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. |
357
+ | `drag-target-handle-only` | Boolean | Make the drag target the drag handle only. |
357
358
  | `drop-nested` | Boolean | Whether nested items can be dropped on this item |
358
359
  | `drop-text` | String | Text to drag and drop |
359
360
  | `href` | String | Address of item link if navigable |
360
361
  | `key` | String | Value to identify item if selectable or draggable |
361
362
  | `label` | String | Explicitly defined label for the element |
362
363
  | `labelled-by` | String | The id of element that provides the label for this element |
364
+ | `padding-type` | String | List item whitespace (`normal` (default), `slim`, `none`)|
363
365
  | `selectable` | Boolean | Indicates an input should be rendered for selecting the item |
364
366
  | `selected` | Boolean | Whether the item is selected |
365
367
  | `skeleton` | Boolean | Renders the input as a skeleton loader |
366
- | `slim` | Boolean | Whether to render the list-item with reduced whitespace|
367
368
 
368
369
  ### Events
369
370
 
@@ -14,10 +14,17 @@ class ListHeader extends RtlMixin(LocalizeCoreElement(LitElement)) {
14
14
  static get properties() {
15
15
  return {
16
16
  /**
17
+ * @ignore
17
18
  * Whether to render a header with reduced whitespace
19
+ * TODO: Remove
18
20
  * @type {boolean}
19
21
  */
20
- slim: { reflect: true, type: Boolean }
22
+ slim: { reflect: true, type: Boolean },
23
+ /**
24
+ * How much padding to render list items with
25
+ * @type {'normal'|'slim'}
26
+ */
27
+ paddingType: { type: String, attribute: 'padding-type' },
21
28
  };
22
29
  }
23
30
 
@@ -36,7 +43,10 @@ class ListHeader extends RtlMixin(LocalizeCoreElement(LitElement)) {
36
43
  margin-top: 6px;
37
44
  min-height: 58px;
38
45
  }
39
- :host([slim]) .d2l-list-header-container {
46
+ :host([slim]) .d2l-list-header-container { /* TODO: Remove */
47
+ min-height: 36px;
48
+ }
49
+ :host([padding-type="slim"]) .d2l-list-header-container {
40
50
  min-height: 36px;
41
51
  }
42
52
  d2l-selection-select-all {
@@ -64,6 +74,7 @@ class ListHeader extends RtlMixin(LocalizeCoreElement(LitElement)) {
64
74
  constructor() {
65
75
  super();
66
76
  this.slim = false;
77
+ this.paddingType = 'normal';
67
78
  }
68
79
 
69
80
  render() {
@@ -54,7 +54,19 @@ export const ListItemMixin = superclass => class extends LocalizeCoreElement(Lis
54
54
  */
55
55
  breakpoints: { type: Array },
56
56
  /**
57
+ * Whether to allow the drag target to be the handle only rather than the entire cell
58
+ * @type {boolean}
59
+ */
60
+ dragTargetHandleOnly: { type: Boolean, attribute: 'drag-target-handle-only' },
61
+ /**
62
+ * How much padding to render list items with
63
+ * @type {'normal'|'slim'|'none'}
64
+ */
65
+ paddingType: { type: String, attribute: 'padding-type' },
66
+ /**
67
+ * @ignore
57
68
  * Whether to render the list-item with reduced whitespace.
69
+ * TODO: Remove in favor of padding-type="slim"
58
70
  * @type {boolean}
59
71
  */
60
72
  slim: { type: Boolean },
@@ -106,6 +118,10 @@ export const ListItemMixin = superclass => class extends LocalizeCoreElement(Lis
106
118
  border-bottom: 1px solid var(--d2l-color-mica);
107
119
  border-top: 1px solid var(--d2l-color-mica);
108
120
  }
121
+ :host([padding-type="none"]) d2l-list-item-generic-layout {
122
+ border-bottom: 0;
123
+ border-top: 0;
124
+ }
109
125
  d2l-list-item-generic-layout[data-separators="none"] {
110
126
  border-bottom: 1px solid transparent;
111
127
  border-top: 1px solid transparent;
@@ -143,10 +159,18 @@ export const ListItemMixin = superclass => class extends LocalizeCoreElement(Lis
143
159
  justify-content: stretch;
144
160
  padding: 0.55rem 0;
145
161
  }
146
- :host([slim]) [slot="content"] {
162
+ :host([slim]) [slot="content"] { /* TODO, remove */
147
163
  padding-bottom: 0.35rem;
148
164
  padding-top: 0.4rem;
149
165
  }
166
+ :host([padding-type="slim"]) [slot="content"] {
167
+ padding-bottom: 0.35rem;
168
+ padding-top: 0.4rem;
169
+ }
170
+ :host([padding-type="none"]) [slot="content"] {
171
+ padding-bottom: 0;
172
+ padding-top: 0;
173
+ }
150
174
  [slot="content"] ::slotted([slot="illustration"]),
151
175
  [slot="content"] .d2l-list-item-illustration * {
152
176
  border-radius: 6px;
@@ -219,7 +243,11 @@ export const ListItemMixin = superclass => class extends LocalizeCoreElement(Lis
219
243
  .d2l-list-item-content-extend-separators d2l-selection-input {
220
244
  margin-left: 0.9rem;
221
245
  }
222
- :host([slim]) d2l-selection-input {
246
+ :host([slim]) d2l-selection-input { /* TODO, remove */
247
+ margin-bottom: 0.55rem;
248
+ margin-top: 0.55rem;
249
+ }
250
+ :host([padding-type="slim"]) d2l-selection-input {
223
251
  margin-bottom: 0.55rem;
224
252
  margin-top: 0.55rem;
225
253
  }
@@ -276,6 +304,7 @@ export const ListItemMixin = superclass => class extends LocalizeCoreElement(Lis
276
304
  super();
277
305
  this.breakpoints = defaultBreakpoints;
278
306
  this.slim = false;
307
+ this.paddingType = 'normal';
279
308
  this._breakpoint = 0;
280
309
  this._contentId = getUniqueId();
281
310
  this._displayKeyboardTooltip = false;
@@ -449,7 +478,7 @@ export const ListItemMixin = superclass => class extends LocalizeCoreElement(Lis
449
478
  ?grid-active="${this.role === 'rowgroup'}">
450
479
  ${this._renderDropTarget()}
451
480
  ${this._renderDragHandle(this._renderOutsideControl)}
452
- ${this._renderDragTarget(this._renderOutsideControlAction)}
481
+ ${this._renderDragTarget(this.dragTargetHandleOnly ? this._renderOutsideControlHandleOnly : this._renderOutsideControlAction)}
453
482
  ${this.selectable ? html`
454
483
  <div slot="control">${this._renderCheckbox()}</div>
455
484
  <div slot="control-action"
@@ -497,6 +526,10 @@ export const ListItemMixin = superclass => class extends LocalizeCoreElement(Lis
497
526
  return html`<div slot="outside-control-action" @mouseenter="${this._onMouseEnter}" @mouseleave="${this._onMouseLeave}">${dragTarget}</div>`;
498
527
  }
499
528
 
529
+ _renderOutsideControlHandleOnly(dragHandle) {
530
+ return html`<div slot="outside-control" @mouseenter="${this._onMouseEnter}" @mouseleave="${this._onMouseLeave}">${dragHandle}</div>`;
531
+ }
532
+
500
533
  _renderTooltipContent() {
501
534
  return html`
502
535
  <div>${this.localize('components.list-item-tooltip.title')}</div>
@@ -1599,6 +1599,12 @@
1599
1599
  "type": "boolean",
1600
1600
  "default": "false"
1601
1601
  },
1602
+ {
1603
+ "name": "describe-content",
1604
+ "description": "Whether to read the contents of the dialog on open",
1605
+ "type": "boolean",
1606
+ "default": "false"
1607
+ },
1602
1608
  {
1603
1609
  "name": "width",
1604
1610
  "description": "The preferred width (unit-less) for the dialog",
@@ -1625,6 +1631,13 @@
1625
1631
  "type": "boolean",
1626
1632
  "default": "false"
1627
1633
  },
1634
+ {
1635
+ "name": "describeContent",
1636
+ "attribute": "describe-content",
1637
+ "description": "Whether to read the contents of the dialog on open",
1638
+ "type": "boolean",
1639
+ "default": "false"
1640
+ },
1628
1641
  {
1629
1642
  "name": "width",
1630
1643
  "attribute": "width",
@@ -6458,6 +6471,11 @@
6458
6471
  "name": "d2l-demo-list-item-custom",
6459
6472
  "path": "./components/list/demo/list-item-custom.js",
6460
6473
  "attributes": [
6474
+ {
6475
+ "name": "drag-target-handle-only",
6476
+ "description": "Whether to allow the drag target to be the handle only rather than the entire cell",
6477
+ "type": "boolean"
6478
+ },
6461
6479
  {
6462
6480
  "name": "breakpoints",
6463
6481
  "description": "Breakpoints for responsiveness in pixels. There are four different breakpoints and only the four largest breakpoints will be used.",
@@ -6465,10 +6483,10 @@
6465
6483
  "default": "[842,636,580,0]"
6466
6484
  },
6467
6485
  {
6468
- "name": "slim",
6469
- "description": "Whether to render the list-item with reduced whitespace.",
6470
- "type": "boolean",
6471
- "default": "false"
6486
+ "name": "padding-type",
6487
+ "description": "How much padding to render list items with",
6488
+ "type": "'normal'|'slim'|'none'",
6489
+ "default": "\"normal\""
6472
6490
  },
6473
6491
  {
6474
6492
  "name": "drag-handle-text",
@@ -6533,6 +6551,12 @@
6533
6551
  }
6534
6552
  ],
6535
6553
  "properties": [
6554
+ {
6555
+ "name": "dragTargetHandleOnly",
6556
+ "attribute": "drag-target-handle-only",
6557
+ "description": "Whether to allow the drag target to be the handle only rather than the entire cell",
6558
+ "type": "boolean"
6559
+ },
6536
6560
  {
6537
6561
  "name": "breakpoints",
6538
6562
  "attribute": "breakpoints",
@@ -6542,11 +6566,16 @@
6542
6566
  },
6543
6567
  {
6544
6568
  "name": "slim",
6545
- "attribute": "slim",
6546
- "description": "Whether to render the list-item with reduced whitespace.",
6547
6569
  "type": "boolean",
6548
6570
  "default": "false"
6549
6571
  },
6572
+ {
6573
+ "name": "paddingType",
6574
+ "attribute": "padding-type",
6575
+ "description": "How much padding to render list items with",
6576
+ "type": "'normal'|'slim'|'none'",
6577
+ "default": "\"normal\""
6578
+ },
6550
6579
  {
6551
6580
  "name": "dragHandleText",
6552
6581
  "attribute": "drag-handle-text",
@@ -6645,19 +6674,24 @@
6645
6674
  "description": "A header for list components containing select-all, etc.",
6646
6675
  "attributes": [
6647
6676
  {
6648
- "name": "slim",
6649
- "description": "Whether to render a header with reduced whitespace",
6650
- "type": "boolean",
6651
- "default": "false"
6677
+ "name": "padding-type",
6678
+ "description": "How much padding to render list items with",
6679
+ "type": "'normal'|'slim'",
6680
+ "default": "\"normal\""
6652
6681
  }
6653
6682
  ],
6654
6683
  "properties": [
6655
6684
  {
6656
6685
  "name": "slim",
6657
- "attribute": "slim",
6658
- "description": "Whether to render a header with reduced whitespace",
6659
6686
  "type": "boolean",
6660
6687
  "default": "false"
6688
+ },
6689
+ {
6690
+ "name": "paddingType",
6691
+ "attribute": "padding-type",
6692
+ "description": "How much padding to render list items with",
6693
+ "type": "'normal'|'slim'",
6694
+ "default": "\"normal\""
6661
6695
  }
6662
6696
  ],
6663
6697
  "slots": [
@@ -6672,6 +6706,11 @@
6672
6706
  "path": "./components/list/list-item-button.js",
6673
6707
  "description": "A component for a \"listitem\" child within a list. It provides semantics, basic layout, breakpoints for responsiveness, a link for navigation, and selection.",
6674
6708
  "attributes": [
6709
+ {
6710
+ "name": "drag-target-handle-only",
6711
+ "description": "Whether to allow the drag target to be the handle only rather than the entire cell",
6712
+ "type": "boolean"
6713
+ },
6675
6714
  {
6676
6715
  "name": "breakpoints",
6677
6716
  "description": "Breakpoints for responsiveness in pixels. There are four different breakpoints and only the four largest breakpoints will be used.",
@@ -6679,10 +6718,10 @@
6679
6718
  "default": "[842,636,580,0]"
6680
6719
  },
6681
6720
  {
6682
- "name": "slim",
6683
- "description": "Whether to render the list-item with reduced whitespace.",
6684
- "type": "boolean",
6685
- "default": "false"
6721
+ "name": "padding-type",
6722
+ "description": "How much padding to render list items with",
6723
+ "type": "'normal'|'slim'|'none'",
6724
+ "default": "\"normal\""
6686
6725
  },
6687
6726
  {
6688
6727
  "name": "drag-handle-text",
@@ -6747,6 +6786,12 @@
6747
6786
  }
6748
6787
  ],
6749
6788
  "properties": [
6789
+ {
6790
+ "name": "dragTargetHandleOnly",
6791
+ "attribute": "drag-target-handle-only",
6792
+ "description": "Whether to allow the drag target to be the handle only rather than the entire cell",
6793
+ "type": "boolean"
6794
+ },
6750
6795
  {
6751
6796
  "name": "breakpoints",
6752
6797
  "attribute": "breakpoints",
@@ -6756,11 +6801,16 @@
6756
6801
  },
6757
6802
  {
6758
6803
  "name": "slim",
6759
- "attribute": "slim",
6760
- "description": "Whether to render the list-item with reduced whitespace.",
6761
6804
  "type": "boolean",
6762
6805
  "default": "false"
6763
6806
  },
6807
+ {
6808
+ "name": "paddingType",
6809
+ "attribute": "padding-type",
6810
+ "description": "How much padding to render list items with",
6811
+ "type": "'normal'|'slim'|'none'",
6812
+ "default": "\"normal\""
6813
+ },
6764
6814
  {
6765
6815
  "name": "dragHandleText",
6766
6816
  "attribute": "drag-handle-text",
@@ -7042,6 +7092,11 @@
7042
7092
  "description": "Address of item link if navigable",
7043
7093
  "type": "string"
7044
7094
  },
7095
+ {
7096
+ "name": "drag-target-handle-only",
7097
+ "description": "Whether to allow the drag target to be the handle only rather than the entire cell",
7098
+ "type": "boolean"
7099
+ },
7045
7100
  {
7046
7101
  "name": "breakpoints",
7047
7102
  "description": "Breakpoints for responsiveness in pixels. There are four different breakpoints and only the four largest breakpoints will be used.",
@@ -7049,10 +7104,10 @@
7049
7104
  "default": "[842,636,580,0]"
7050
7105
  },
7051
7106
  {
7052
- "name": "slim",
7053
- "description": "Whether to render the list-item with reduced whitespace.",
7054
- "type": "boolean",
7055
- "default": "false"
7107
+ "name": "padding-type",
7108
+ "description": "How much padding to render list items with",
7109
+ "type": "'normal'|'slim'|'none'",
7110
+ "default": "\"normal\""
7056
7111
  },
7057
7112
  {
7058
7113
  "name": "drag-handle-text",
@@ -7129,6 +7184,12 @@
7129
7184
  "description": "Address of item link if navigable",
7130
7185
  "type": "string"
7131
7186
  },
7187
+ {
7188
+ "name": "dragTargetHandleOnly",
7189
+ "attribute": "drag-target-handle-only",
7190
+ "description": "Whether to allow the drag target to be the handle only rather than the entire cell",
7191
+ "type": "boolean"
7192
+ },
7132
7193
  {
7133
7194
  "name": "breakpoints",
7134
7195
  "attribute": "breakpoints",
@@ -7138,11 +7199,16 @@
7138
7199
  },
7139
7200
  {
7140
7201
  "name": "slim",
7141
- "attribute": "slim",
7142
- "description": "Whether to render the list-item with reduced whitespace.",
7143
7202
  "type": "boolean",
7144
7203
  "default": "false"
7145
7204
  },
7205
+ {
7206
+ "name": "paddingType",
7207
+ "attribute": "padding-type",
7208
+ "description": "How much padding to render list items with",
7209
+ "type": "'normal'|'slim'|'none'",
7210
+ "default": "\"normal\""
7211
+ },
7146
7212
  {
7147
7213
  "name": "dragHandleText",
7148
7214
  "attribute": "drag-handle-text",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "1.225.0",
3
+ "version": "1.227.1",
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",