@brightspace-ui/core 3.331.3 → 3.333.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.
@@ -0,0 +1,46 @@
1
+ import { css } from 'lit';
2
+
3
+ export const toolbarMenuItemStyles = css`
4
+ :host {
5
+ --d2l-menu-item-lines: 1;
6
+ align-items: center;
7
+ border-radius: 3px;
8
+ display: flex;
9
+ gap: 12px;
10
+ margin: 0;
11
+ padding: 7px 12px;
12
+ width: 100%;
13
+ }
14
+ :host([hidden]) {
15
+ display: none;
16
+ }
17
+ `;
18
+
19
+ export const toolbarMenuItemIconStyles = css`
20
+ .item-icon-container {
21
+ flex: none;
22
+ }
23
+ .item-icon-hidden {
24
+ display: none;
25
+ }
26
+ :host(:hover) d2l-icon,
27
+ :host(:focus-visible) d2l-icon,
28
+ :host(:hover) ::slotted(d2l-icon-custom),
29
+ :host(:focus-visible) ::slotted(d2l-icon-custom) {
30
+ fill: var(--d2l-menu-foreground-color-hover);
31
+ }
32
+ `;
33
+
34
+ export const toolbarMenuItemTextStyles = css`
35
+ ::slotted(p),
36
+ ::slotted(h1),
37
+ ::slotted(h2),
38
+ ::slotted(h3),
39
+ ::slotted(h4),
40
+ ::slotted(h5),
41
+ ::slotted(h6),
42
+ ::slotted(blockquote),
43
+ ::slotted(code) {
44
+ margin: 0.2em 0 !important;
45
+ }
46
+ `;
@@ -0,0 +1,53 @@
1
+ import '../icons/icon.js';
2
+ import { css, html, LitElement, nothing } from 'lit';
3
+ import { toolbarMenuItemIconStyles, toolbarMenuItemStyles, toolbarMenuItemTextStyles } from './toolbar-menu-item-styles.js';
4
+ import { classMap } from 'lit/directives/class-map.js';
5
+ import { MenuItemMixin } from '../menu/menu-item-mixin.js';
6
+ import { menuItemStyles } from '../menu/menu-item-styles.js';
7
+ import { SlottedIconMixin } from '../icons/slotted-icon-mixin.js';
8
+
9
+ /**
10
+ * A toolbar menu-item that performs an action
11
+ */
12
+ class ToolbarMenuItem extends MenuItemMixin(SlottedIconMixin(LitElement)) {
13
+
14
+ static get styles() {
15
+ return [menuItemStyles, toolbarMenuItemStyles, toolbarMenuItemIconStyles, toolbarMenuItemTextStyles, css`
16
+ .nested-icon {
17
+ flex: none;
18
+ }
19
+ `];
20
+ }
21
+
22
+ firstUpdated(changedProperties) {
23
+ super.firstUpdated(changedProperties);
24
+ this.addEventListener('d2l-menu-item-select', this.#handleMenuItemSelect);
25
+ }
26
+
27
+ render() {
28
+ const itemIconClasses = {
29
+ 'item-icon-container': true,
30
+ 'item-icon-hidden': !this.hasIcon()
31
+ };
32
+ return html`
33
+ <div class="${classMap(itemIconClasses)}">${this._renderIcon()}</div>
34
+ <div class="d2l-menu-item-text"><slot name="text">${this.text}</slot></div>
35
+ ${this.hasChildView ? html`<d2l-icon class="nested-icon" icon="tier1:chevron-right"></d2l-icon>` : nothing}
36
+ <slot></slot>
37
+ `;
38
+
39
+ }
40
+
41
+ #handleMenuItemSelect = e => {
42
+ e.stopPropagation();
43
+
44
+ // ignore if target is not this item (nested menu case)
45
+ if (e.target !== this) return;
46
+
47
+ /** Dispatched when the toolbar menu item is selected */
48
+ this.dispatchEvent(new CustomEvent('d2l-toolbar-menu-item-select'));
49
+ };
50
+
51
+ }
52
+
53
+ customElements.define('d2l-toolbar-menu-item', ToolbarMenuItem);
@@ -17579,6 +17579,88 @@
17579
17579
  }
17580
17580
  ]
17581
17581
  },
17582
+ {
17583
+ "name": "d2l-toolbar-menu-item",
17584
+ "path": "./components/toolbar/toolbar-menu-item.js",
17585
+ "description": "A toolbar menu-item that performs an action",
17586
+ "attributes": [
17587
+ {
17588
+ "name": "text",
17589
+ "description": "REQUIRED: Text displayed by the menu item",
17590
+ "type": "string"
17591
+ },
17592
+ {
17593
+ "name": "description",
17594
+ "description": "ACCESSIBILITY: A description of the menu item that will be used by screen readers for additional context",
17595
+ "type": "string"
17596
+ },
17597
+ {
17598
+ "name": "disabled",
17599
+ "description": "Disables the menu item",
17600
+ "type": "boolean",
17601
+ "default": "false"
17602
+ },
17603
+ {
17604
+ "name": "lines",
17605
+ "description": "The number of lines to display before truncating text with an ellipsis. Defaults to 2.",
17606
+ "type": "number",
17607
+ "default": "2"
17608
+ },
17609
+ {
17610
+ "name": "icon",
17611
+ "description": "Preset icon key (e.g. \"tier1:gear\")",
17612
+ "type": "string"
17613
+ }
17614
+ ],
17615
+ "properties": [
17616
+ {
17617
+ "name": "text",
17618
+ "attribute": "text",
17619
+ "description": "REQUIRED: Text displayed by the menu item",
17620
+ "type": "string"
17621
+ },
17622
+ {
17623
+ "name": "description",
17624
+ "attribute": "description",
17625
+ "description": "ACCESSIBILITY: A description of the menu item that will be used by screen readers for additional context",
17626
+ "type": "string"
17627
+ },
17628
+ {
17629
+ "name": "disabled",
17630
+ "attribute": "disabled",
17631
+ "description": "Disables the menu item",
17632
+ "type": "boolean",
17633
+ "default": "false"
17634
+ },
17635
+ {
17636
+ "name": "lines",
17637
+ "attribute": "lines",
17638
+ "description": "The number of lines to display before truncating text with an ellipsis. Defaults to 2.",
17639
+ "type": "number",
17640
+ "default": "2"
17641
+ },
17642
+ {
17643
+ "name": "icon",
17644
+ "attribute": "icon",
17645
+ "description": "Preset icon key (e.g. \"tier1:gear\")",
17646
+ "type": "string"
17647
+ }
17648
+ ],
17649
+ "events": [
17650
+ {
17651
+ "name": "d2l-toolbar-menu-item-select",
17652
+ "description": "Dispatched when the toolbar menu item is selected"
17653
+ },
17654
+ {
17655
+ "name": "d2l-menu-item-select",
17656
+ "description": "Dispatched when the menu item is selected"
17657
+ },
17658
+ {
17659
+ "name": "d2l-menu-item-visibility-change",
17660
+ "description": "Dispatched when the visibility of the menu item changes"
17661
+ }
17662
+ ]
17663
+ },
17582
17664
  {
17583
17665
  "name": "d2l-toolbar-separator",
17584
17666
  "path": "./components/toolbar/toolbar-separator.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.331.3",
3
+ "version": "3.333.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",