@brightspace-ui/core 3.346.0 → 3.347.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.
@@ -41,6 +41,7 @@ class ToolbarButton extends SlottedIconMixin(FocusMixin(ToolbarItemMixin(ThemeMi
41
41
  return html`
42
42
  <button
43
43
  aria-disabled="${this.disabled ? 'true' : 'false'}"
44
+ class="item"
44
45
  @click="${this.#handleClick}"
45
46
  id="action-button"
46
47
  tabindex="${this._activeFocusable ? 0 : -1}"
@@ -38,7 +38,7 @@ class ToolbarDropdown extends FocusMixin(DropdownOpenerMixin(SlottedIconMixin(To
38
38
  :host {
39
39
  font-size: 1rem;
40
40
  }
41
- button {
41
+ .item {
42
42
  align-items: center;
43
43
  display: flex;
44
44
  font-size: 0.7rem;
@@ -49,17 +49,17 @@ class ToolbarDropdown extends FocusMixin(DropdownOpenerMixin(SlottedIconMixin(To
49
49
  text-align: start;
50
50
  width: 100%;
51
51
  }
52
- button > .value-text {
52
+ .item > .value-text {
53
53
  flex: auto;
54
54
  overflow: hidden;
55
55
  text-overflow: ellipsis;
56
56
  white-space: nowrap;
57
57
  }
58
- button[aria-expanded="true"] .background {
58
+ .item[aria-expanded="true"] .background {
59
59
  background-color: var(--d2l-theme-background-color-interactive-secondary-default);
60
60
  transform: scale(1, 1);
61
61
  }
62
- :host([theme="dark"]) button[aria-expanded="true"] .background {
62
+ :host([theme="dark"]) .item[aria-expanded="true"] .background {
63
63
  background-color: var(--d2l-color-tungsten);
64
64
  transform: scale(1, 1);
65
65
  }
@@ -90,6 +90,7 @@ class ToolbarDropdown extends FocusMixin(DropdownOpenerMixin(SlottedIconMixin(To
90
90
  return html`
91
91
  <button
92
92
  aria-disabled="${this.disabled ? 'true' : 'false'}"
93
+ class="item"
93
94
  id="opener"
94
95
  @keydown="${this.#handleKeyDown}"
95
96
  tabindex="${this._activeFocusable ? 0 : -1}"
@@ -9,7 +9,7 @@ export const toolbarButtonStyles = css`
9
9
  :host([hidden]) {
10
10
  display: none;
11
11
  }
12
- button {
12
+ .item {
13
13
  --d2l-focus-ring-offset: 0;
14
14
  align-items: center;
15
15
  background-color: transparent;
@@ -50,28 +50,28 @@ export const toolbarButtonStyles = css`
50
50
  transition: background-color 100ms linear, transform 100ms linear;
51
51
  z-index: -1;
52
52
  }
53
- ${getFocusRingStyles('button')}
53
+ ${getFocusRingStyles('.item')}
54
54
  @supports not selector(:focus-visible) {
55
- button:hover > .background,
56
- button:focus > .background {
55
+ .item:hover > .background,
56
+ .item:focus > .background {
57
57
  background-color: var(--d2l-theme-background-color-interactive-secondary-default);
58
58
  transform: scale(1, 1);
59
59
  }
60
60
  }
61
61
  @supports selector(:focus-visible) {
62
- button:hover > .background,
63
- button:focus-visible > .background {
62
+ .item:hover > .background,
63
+ .item:focus-visible > .background {
64
64
  background-color: var(--d2l-theme-background-color-interactive-secondary-default);
65
65
  transform: scale(1, 1);
66
66
  }
67
67
  }
68
- button[disabled],
69
- button[aria-disabled="true"] {
68
+ .item[disabled],
69
+ .item[aria-disabled="true"] {
70
70
  cursor: default;
71
71
  opacity: var(--d2l-theme-opacity-disabled-control);
72
72
  }
73
- button[disabled]:hover,
74
- button[disabled]:focus {
73
+ .item[disabled]:hover,
74
+ .item[disabled]:focus {
75
75
  background-color: transparent;
76
76
  fill: var(--d2l-theme-text-color-static-standard);
77
77
  }
@@ -82,18 +82,18 @@ export const toolbarButtonStyles = css`
82
82
  }
83
83
 
84
84
  @supports not selector(:focus-visible) {
85
- :host([theme="dark"]) button:hover > .background,
86
- :host([theme="dark"]) button:focus > .background {
85
+ :host([theme="dark"]) .item:hover > .background,
86
+ :host([theme="dark"]) .item:focus > .background {
87
87
  background-color: var(--d2l-color-tungsten);
88
88
  }
89
89
  }
90
90
  @supports selector(:focus-visible) {
91
- :host([theme="dark"]) button:hover > .background,
92
- :host([theme="dark"]) button:focus-visible > .background {
91
+ :host([theme="dark"]) .item:hover > .background,
92
+ :host([theme="dark"]) .item:focus-visible > .background {
93
93
  background-color: var(--d2l-color-tungsten);
94
94
  }
95
95
  }
96
- :host([theme="dark"]) button,
96
+ :host([theme="dark"]) .item,
97
97
  :host([theme="dark"]) ::slotted(d2l-icon-custom),
98
98
  :host([theme="dark"]) d2l-icon {
99
99
  color: var(--d2l-color-regolith);
@@ -0,0 +1,69 @@
1
+ import '../tooltip/tooltip.js';
2
+ import { html, LitElement } from 'lit';
3
+ import { FocusMixin } from '../../mixins/focus/focus-mixin.js';
4
+ import { ifDefined } from 'lit/directives/if-defined.js';
5
+ import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
6
+ import { PropertyRequiredMixin } from '../../mixins/property-required/property-required-mixin.js';
7
+ import { SlottedIconMixin } from '../icons/slotted-icon-mixin.js';
8
+ import { ThemeMixin } from '../../mixins/theme/theme-mixin.js';
9
+ import { toolbarButtonStyles } from './toolbar-item-styles.js';
10
+ import { ToolbarItemMixin } from './toolbar-item-mixin.js';
11
+
12
+ /**
13
+ * An icon-only link for use in a toolbar.
14
+ */
15
+ class ToolbarLink extends LocalizeCoreElement(SlottedIconMixin(FocusMixin(ToolbarItemMixin(ThemeMixin(PropertyRequiredMixin(LitElement)))))) {
16
+
17
+ static properties = {
18
+ /** Disables navigation while keeping the link focusable in the toolbar. */
19
+ disabled: { type: Boolean },
20
+ /** REQUIRED: URL or URL fragment of the link. */
21
+ href: { type: String, required: true },
22
+ /** Where to display the linked URL. */
23
+ target: { type: String },
24
+ /** ACCESSIBILITY: REQUIRED: Accessible label and tooltip text for the link. */
25
+ text: { type: String, required: true }
26
+ };
27
+
28
+ static styles = [super.styles, toolbarButtonStyles];
29
+
30
+ constructor() {
31
+ super();
32
+ this.disabled = false;
33
+ this.text = '';
34
+ }
35
+
36
+ static get focusElementSelector() {
37
+ return 'a';
38
+ }
39
+
40
+ render() {
41
+ const opensInNewWindow = !this.disabled && this.target === '_blank';
42
+ return html`
43
+ <a
44
+ aria-description="${ifDefined(opensInNewWindow ? this.localize('components.link.open-in-new-window') : undefined)}"
45
+ aria-disabled="${ifDefined(this.disabled ? 'true' : undefined)}"
46
+ class="item"
47
+ @click="${this.#handleClick}"
48
+ href="${ifDefined(this.disabled ? undefined : this.href)}"
49
+ id="action-link"
50
+ rel="${ifDefined(opensInNewWindow ? 'noopener noreferrer' : undefined)}"
51
+ role="${ifDefined(this.disabled ? 'link' : undefined)}"
52
+ tabindex="${this._activeFocusable ? 0 : -1}"
53
+ target="${ifDefined(this.target)}">
54
+ <span class="background"></span>
55
+ ${this._renderIcon()}
56
+ </a>
57
+ <d2l-tooltip class="vdiff-target" for="action-link" for-type="label">${this.text}</d2l-tooltip>
58
+ `;
59
+ }
60
+
61
+ #handleClick(event) {
62
+ if (!this.disabled) return;
63
+ event.preventDefault();
64
+ event.stopPropagation();
65
+ }
66
+
67
+ }
68
+
69
+ customElements.define('d2l-toolbar-link', ToolbarLink);
@@ -42,23 +42,23 @@ class ToolbarToggle extends SlottedIconMixin(FocusMixin(ToolbarItemMixin(ThemeMi
42
42
  };
43
43
 
44
44
  static styles = [super.styles, toolbarButtonStyles, css`
45
- button[aria-pressed="true"] > .background {
45
+ .item[aria-pressed="true"] > .background {
46
46
  background-color: var(--d2l-color-celestine-plus-2);
47
47
  transform: scale(1, 1);
48
48
  }
49
- button[aria-pressed="true"]:hover > .background {
49
+ .item[aria-pressed="true"]:hover > .background {
50
50
  background-color: #dbf5ff; /* not a daylight color */
51
51
  }
52
- button[aria-pressed="true"] ::slotted(d2l-icon-custom),
53
- button[aria-pressed="true"] d2l-icon {
52
+ .item[aria-pressed="true"] ::slotted(d2l-icon-custom),
53
+ .item[aria-pressed="true"] d2l-icon {
54
54
  fill: var(--d2l-color-celestine);
55
55
  }
56
- :host([theme="dark"]) button[aria-pressed="true"] > .background,
57
- :host([theme="dark"]) button[aria-pressed="true"]:hover > .background {
56
+ :host([theme="dark"]) .item[aria-pressed="true"] > .background,
57
+ :host([theme="dark"]) .item[aria-pressed="true"]:hover > .background {
58
58
  background-color: var(--d2l-color-tungsten);
59
59
  }
60
- :host([theme="dark"]) button[aria-pressed="true"] ::slotted(d2l-icon-custom),
61
- :host([theme="dark"]) button[aria-pressed="true"] d2l-icon {
60
+ :host([theme="dark"]) .item[aria-pressed="true"] ::slotted(d2l-icon-custom),
61
+ :host([theme="dark"]) .item[aria-pressed="true"] d2l-icon {
62
62
  fill: var(--d2l-color-regolith);
63
63
  }
64
64
  `];
@@ -82,6 +82,7 @@ class ToolbarToggle extends SlottedIconMixin(FocusMixin(ToolbarItemMixin(ThemeMi
82
82
  aria-disabled="${this.disabled ? 'true' : 'false'}"
83
83
  aria-expanded="${ifDefined(this.expandable ? (this.expanded ? 'true' : 'false') : undefined)}"
84
84
  aria-pressed="${ifDefined(!this.expandable ? (this.pressed ? 'true' : 'false') : undefined)}"
85
+ class="item"
85
86
  @click="${this.#handleClick}"
86
87
  id="action-button"
87
88
  tabindex="${this._activeFocusable ? 0 : -1}"
@@ -17594,6 +17594,83 @@
17594
17594
  }
17595
17595
  ]
17596
17596
  },
17597
+ {
17598
+ "name": "d2l-toolbar-link",
17599
+ "path": "./components/toolbar/toolbar-link.js",
17600
+ "description": "An icon-only link for use in a toolbar.",
17601
+ "attributes": [
17602
+ {
17603
+ "name": "href",
17604
+ "description": "REQUIRED: URL or URL fragment of the link.",
17605
+ "type": "string"
17606
+ },
17607
+ {
17608
+ "name": "target",
17609
+ "description": "Where to display the linked URL.",
17610
+ "type": "string"
17611
+ },
17612
+ {
17613
+ "name": "disabled",
17614
+ "description": "Disables navigation while keeping the link focusable in the toolbar.",
17615
+ "type": "boolean",
17616
+ "default": "false"
17617
+ },
17618
+ {
17619
+ "name": "text",
17620
+ "description": "ACCESSIBILITY: REQUIRED: Accessible label and tooltip text for the link.",
17621
+ "type": "string",
17622
+ "default": "\"\""
17623
+ },
17624
+ {
17625
+ "name": "icon",
17626
+ "description": "Preset icon key (e.g. \"tier1:gear\")",
17627
+ "type": "string"
17628
+ }
17629
+ ],
17630
+ "properties": [
17631
+ {
17632
+ "name": "href",
17633
+ "attribute": "href",
17634
+ "description": "REQUIRED: URL or URL fragment of the link.",
17635
+ "type": "string"
17636
+ },
17637
+ {
17638
+ "name": "target",
17639
+ "attribute": "target",
17640
+ "description": "Where to display the linked URL.",
17641
+ "type": "string"
17642
+ },
17643
+ {
17644
+ "name": "styles",
17645
+ "type": "array",
17646
+ "default": "[\"styles\",\"toolbarButtonStyles\"]"
17647
+ },
17648
+ {
17649
+ "name": "disabled",
17650
+ "attribute": "disabled",
17651
+ "description": "Disables navigation while keeping the link focusable in the toolbar.",
17652
+ "type": "boolean",
17653
+ "default": "false"
17654
+ },
17655
+ {
17656
+ "name": "text",
17657
+ "attribute": "text",
17658
+ "description": "ACCESSIBILITY: REQUIRED: Accessible label and tooltip text for the link.",
17659
+ "type": "string",
17660
+ "default": "\"\""
17661
+ },
17662
+ {
17663
+ "name": "icon",
17664
+ "attribute": "icon",
17665
+ "description": "Preset icon key (e.g. \"tier1:gear\")",
17666
+ "type": "string"
17667
+ },
17668
+ {
17669
+ "name": "isToolbarItem",
17670
+ "type": "boolean"
17671
+ }
17672
+ ]
17673
+ },
17597
17674
  {
17598
17675
  "name": "d2l-toolbar-menu-item",
17599
17676
  "path": "./components/toolbar/toolbar-menu-item.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.346.0",
3
+ "version": "3.347.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",