@brightspace-ui/core 3.346.0 → 3.348.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}"
@@ -21,7 +21,12 @@ class Toolbar extends PropertyRequiredMixin(LitElement) {
21
21
  * ACCESSIBILITY: REQUIRED: Accessible label for the toolbar
22
22
  * @type {string}
23
23
  */
24
- label: { type: String, required: true }
24
+ label: { type: String, required: true },
25
+ /**
26
+ * Hides the border
27
+ * @type {boolean}
28
+ */
29
+ noBorder: { type: Boolean, reflect: true, attribute: 'no-border' }
25
30
  };
26
31
 
27
32
  static styles = css`
@@ -38,11 +43,16 @@ class Toolbar extends PropertyRequiredMixin(LitElement) {
38
43
  gap: 4px;
39
44
  padding-block-end: 4px;
40
45
  }
46
+ :host([no-border]) .container {
47
+ border: none;
48
+ padding-block-end: 0;
49
+ }
41
50
  `;
42
51
 
43
52
  constructor() {
44
53
  super();
45
54
  this.label = '';
55
+ this.noBorder = false;
46
56
  }
47
57
 
48
58
  render() {
@@ -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",
@@ -17797,12 +17874,18 @@
17797
17874
  "description": "ACCESSIBILITY: REQUIRED: Accessible label for the toolbar",
17798
17875
  "type": "string",
17799
17876
  "default": "\"\""
17877
+ },
17878
+ {
17879
+ "name": "no-border",
17880
+ "description": "Hides the border",
17881
+ "type": "boolean",
17882
+ "default": "false"
17800
17883
  }
17801
17884
  ],
17802
17885
  "properties": [
17803
17886
  {
17804
17887
  "name": "styles",
17805
- "default": "\"css`\\n\\t\\t:host {\\n\\t\\t\\tdisplay: inline-block;\\n\\t\\t}\\n\\t\\t:host([hidden]) {\\n\\t\\t\\tdisplay: none;\\n\\t\\t}\\n\\t\\t.container {\\n\\t\\t\\tborder-block-end: 1px solid var(--d2l-theme-border-color-standard);\\n\\t\\t\\tdisplay: flex;\\n\\t\\t\\tflex-wrap: wrap;\\n\\t\\t\\tgap: 4px;\\n\\t\\t\\tpadding-block-end: 4px;\\n\\t\\t}\\n\\t`\""
17888
+ "default": "\"css`\\n\\t\\t:host {\\n\\t\\t\\tdisplay: inline-block;\\n\\t\\t}\\n\\t\\t:host([hidden]) {\\n\\t\\t\\tdisplay: none;\\n\\t\\t}\\n\\t\\t.container {\\n\\t\\t\\tborder-block-end: 1px solid var(--d2l-theme-border-color-standard);\\n\\t\\t\\tdisplay: flex;\\n\\t\\t\\tflex-wrap: wrap;\\n\\t\\t\\tgap: 4px;\\n\\t\\t\\tpadding-block-end: 4px;\\n\\t\\t}\\n\\t\\t:host([no-border]) .container {\\n\\t\\t\\tborder: none;\\n\\t\\t\\tpadding-block-end: 0;\\n\\t\\t}\\n\\t`\""
17806
17889
  },
17807
17890
  {
17808
17891
  "name": "label",
@@ -17810,6 +17893,13 @@
17810
17893
  "description": "ACCESSIBILITY: REQUIRED: Accessible label for the toolbar",
17811
17894
  "type": "string",
17812
17895
  "default": "\"\""
17896
+ },
17897
+ {
17898
+ "name": "noBorder",
17899
+ "attribute": "no-border",
17900
+ "description": "Hides the border",
17901
+ "type": "boolean",
17902
+ "default": "false"
17813
17903
  }
17814
17904
  ],
17815
17905
  "slots": [
@@ -171,7 +171,9 @@ The localized value of [these common terms](https://github.com/BrightspaceUI/int
171
171
  Example:
172
172
 
173
173
  ```javascript
174
- const value = localizer.localizeCommon('actions:copy'); // -> Copy in en-US
174
+ render() {
175
+ return html`<button>${this.localizeCommon('actions:save')}</button>`;
176
+ }
175
177
  ```
176
178
 
177
179
  #### localizeCharacter
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.346.0",
3
+ "version": "3.348.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",