@brightspace-ui/core 3.202.0 → 3.203.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.
@@ -5,13 +5,10 @@ import { css, html, LitElement } from 'lit';
5
5
  import { findFormElements, flattenMap, getFormElementData, isCustomFormElement, isNativeFormElement } from './form-helper.js';
6
6
  import { findComposedAncestor } from '../../helpers/dom.js';
7
7
  import { getComposedActiveElement } from '../../helpers/focus.js';
8
- import { getFlag } from '../../helpers/flags.js';
9
8
  import { getUniqueId } from '../../helpers/uniqueId.js';
10
9
  import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
11
10
  import { localizeFormElement } from './form-element-localize-helper.js';
12
11
 
13
- const formElementMixinWithNestedFormsParticipates = getFlag('form-element-mixin-nested-forms', true);
14
-
15
12
  /**
16
13
  * A component that can be used to build sections containing interactive controls that are validated and submitted as a group.
17
14
  * Values of these interactive controls are aggregated but the user is responsible for handling submission via the @d2l-form-submit event.
@@ -181,17 +178,10 @@ class Form extends LocalizeCoreElement(LitElement) {
181
178
  }
182
179
  }
183
180
  }
184
- } else if (!formElementMixinWithNestedFormsParticipates) {
185
- const eleErrors = await this._validateFormElement(ele, true);
186
- if (eleErrors.length > 0) {
187
- errorMap.set(ele, eleErrors);
188
- }
189
181
  }
190
- if (formElementMixinWithNestedFormsParticipates) {
191
- const eleErrors = await this._validateFormElement(ele, true);
192
- if (eleErrors.length > 0) {
193
- errorMap.set(ele, eleErrors);
194
- }
182
+ const eleErrors = await this._validateFormElement(ele, true);
183
+ if (eleErrors.length > 0) {
184
+ errorMap.set(ele, eleErrors);
195
185
  }
196
186
  }
197
187
  const flattenedErrorMap = flattenMap(errorMap);
@@ -1,70 +1,22 @@
1
1
  import { css, html, LitElement } from 'lit';
2
- import { getFlag } from '../../helpers/flags.js';
3
- import { ifDefined } from 'lit/directives/if-defined.js';
4
2
  import { LinkMixin } from '../link/link-mixin.js';
5
- import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
6
3
  import { MenuItemMixin } from './menu-item-mixin.js';
7
4
  import { menuItemStyles } from './menu-item-styles.js';
8
5
 
9
- const newWindowIconEnabled = getFlag('GAUD-8295-menu-item-link-new-window-icon', true);
10
-
11
6
  /**
12
7
  * A menu item component used for navigating.
13
8
  * @fires click - Dispatched when the link is clicked
14
9
  * @slot supporting - Allows supporting information to be displayed on the right-most side of the menu item
15
10
  */
16
- class MenuItemLink extends (newWindowIconEnabled ? LinkMixin(MenuItemMixin(LitElement)) : LocalizeCoreElement(MenuItemMixin(LitElement))) {
11
+ class MenuItemLink extends LinkMixin(MenuItemMixin(LitElement)) {
17
12
 
18
13
  static get properties() {
19
- // remove this block when cleaning up GAUD-8295-menu-item-link-new-window-icon
20
- if (!newWindowIconEnabled) return {
21
- /**
22
- * Prompts the user to save the linked URL instead of navigating to it.
23
- * Must be to a resource on the same origin.
24
- * Can be used with or without a value, when set the value becomes the filename.
25
- * @type {string}
26
- */
27
- download: { type: String },
28
- /**
29
- * REQUIRED: The url the menu item link navigates to
30
- * @type {string}
31
- */
32
- href: { type: String },
33
- /**
34
- * Where to display the linked URL
35
- * @type {string}
36
- */
37
- target: { type: String },
38
- _ariaDescription: { type: String, attribute: 'aria-description', reflect: true },
39
- };
40
-
41
14
  return {
42
15
  _ariaDescription: { type: String, attribute: 'aria-description', reflect: true },
43
16
  };
44
17
  }
45
18
 
46
19
  static get styles() {
47
- // remove this block when cleaning up GAUD-8295-menu-item-link-new-window-icon
48
- if (!newWindowIconEnabled) return [ menuItemStyles,
49
- css`
50
- :host {
51
- display: block;
52
- padding: 0;
53
- }
54
-
55
- :host > a {
56
- align-items: center;
57
- color: inherit;
58
- display: flex;
59
- line-height: 1rem;
60
- outline: none;
61
- overflow-x: hidden;
62
- padding: 0.75rem 1rem;
63
- text-decoration: none;
64
- }
65
- `
66
- ];
67
-
68
20
  return [ super.styles, menuItemStyles,
69
21
  css`
70
22
  :host {
@@ -107,17 +59,6 @@ class MenuItemLink extends (newWindowIconEnabled ? LinkMixin(MenuItemMixin(LitEl
107
59
  }
108
60
 
109
61
  render() {
110
- // remove this block when cleaning up GAUD-8295-menu-item-link-new-window-icon
111
- if (!newWindowIconEnabled) {
112
- const rel = this.target ? 'noreferrer noopener' : undefined;
113
- return html`
114
- <a download="${ifDefined(this.download)}" href="${ifDefined(this.href)}" rel="${ifDefined(rel)}" target="${ifDefined(this.target)}" tabindex="-1">
115
- <div class="d2l-menu-item-text">${this.text}</div>
116
- <div class="d2l-menu-item-supporting"><slot name="supporting"></slot></div>
117
- </a>
118
- `;
119
- }
120
-
121
62
  const inner = html`
122
63
  <div class="d2l-menu-item-text">${this.text}</div>
123
64
  ${this._renderNewWindowIcon()}
@@ -129,16 +70,11 @@ class MenuItemLink extends (newWindowIconEnabled ? LinkMixin(MenuItemMixin(LitEl
129
70
 
130
71
  willUpdate(changedProperties) {
131
72
  super.willUpdate(changedProperties);
132
- if (newWindowIconEnabled && changedProperties.has('_ariaLabel') || changedProperties.has('target')) {
73
+ if (changedProperties.has('_ariaLabel') || changedProperties.has('target')) {
133
74
  this._ariaDescription = this.getNewWindowDescription(this._ariaLabel);
134
75
  }
135
76
  }
136
77
 
137
- // remove this function when cleaning up GAUD-8295-menu-item-link-new-window-icon
138
- getNewWindowDescription(label) {
139
- return label && this.target === '_blank' ? this.localize('components.link.open-in-new-window') : undefined;
140
- }
141
-
142
78
  _onKeyDown(e) {
143
79
  if (e.keyCode === this.__keyCodes.ENTER || e.keyCode === this.__keyCodes.SPACE) {
144
80
  this.shadowRoot.querySelector('a').click();
@@ -45,6 +45,7 @@
45
45
  <d2l-meter-linear value="3" max="6" text="Visited: {x/y}" percent text-hidden></d2l-meter-linear>
46
46
  <d2l-meter-linear value="3" max="6" text="Visited: {%}"></d2l-meter-linear>
47
47
  <d2l-meter-linear value="3" max="6" text="You're doing great!" percent></d2l-meter-linear>
48
+ <d2l-meter-linear value="3" max="6" text="You're doing great!" text-align-end></d2l-meter-linear>
48
49
  <d2l-meter-linear value="1" max="3" text="Round up({x/y} => {%})" percent percent-rounding-mode="ceil"></d2l-meter-linear>
49
50
  <d2l-meter-linear value="2" max="3" text="Round down({x/y} => {%})" percent percent-rounding-mode="floor"></d2l-meter-linear>
50
51
  </div>
@@ -13,7 +13,12 @@ class MeterLinear extends MeterMixin(LitElement) {
13
13
  * Keeps the meter to a single line
14
14
  * @type {boolean}
15
15
  */
16
- textInline: { type: Boolean, attribute: 'text-inline', reflect: true }
16
+ textInline: { type: Boolean, attribute: 'text-inline', reflect: true },
17
+ /**
18
+ * Force text to be aligned to the end of the meter
19
+ * @type {boolean}
20
+ */
21
+ textAlignEnd: { type: Boolean, attribute: 'text-align-end', reflect: true }
17
22
  };
18
23
  }
19
24
  static get styles() {
@@ -94,6 +99,7 @@ class MeterLinear extends MeterMixin(LitElement) {
94
99
  constructor() {
95
100
  super();
96
101
  this.textInline = false;
102
+ this.textAlignEnd = false;
97
103
  }
98
104
 
99
105
  render() {
@@ -106,7 +112,7 @@ class MeterLinear extends MeterMixin(LitElement) {
106
112
  const primaryAria = this._primary(this.value, this.max, true);
107
113
  const secondaryAria = this._secondary(this.value, this.max, this.text, true);
108
114
  const textClasses = {
109
- 'd2l-meter-linear-text-space-between': !this.textInline && secondary !== this.text,
115
+ 'd2l-meter-linear-text-space-between': !this.textInline && (secondary !== this.text || this.textAlignEnd),
110
116
  'd2l-body-small': true,
111
117
  'd2l-meter-linear-text': true
112
118
  };
@@ -1,5 +1,4 @@
1
1
  # Tag List
2
- *This component is in progress. The API is generally stable but there could be some appearance or minor behavior churn in the short-term.*
3
2
 
4
3
  Tag lists are used to present a list of compact, discrete pieces of information.
5
4
 
@@ -10985,10 +10985,103 @@
10985
10985
  "name": "d2l-menu-item-link",
10986
10986
  "path": "./components/menu/menu-item-link.js",
10987
10987
  "description": "A menu item component used for navigating.",
10988
+ "attributes": [
10989
+ {
10990
+ "name": "download",
10991
+ "description": "Prompts the user to save the linked URL instead of navigating to it.\nMust be to a resource on the same origin.\nCan be used with or without a value, when set the value becomes the filename.",
10992
+ "type": "string"
10993
+ },
10994
+ {
10995
+ "name": "href",
10996
+ "description": "REQUIRED: URL or URL fragment of the link",
10997
+ "type": "string"
10998
+ },
10999
+ {
11000
+ "name": "target",
11001
+ "description": "Where to display the linked URL",
11002
+ "type": "string"
11003
+ },
11004
+ {
11005
+ "name": "text",
11006
+ "description": "REQUIRED: Text displayed by the menu item",
11007
+ "type": "string"
11008
+ },
11009
+ {
11010
+ "name": "description",
11011
+ "description": "ACCESSIBILITY: A description of the menu item that will be used by screen readers for additional context",
11012
+ "type": "string"
11013
+ },
11014
+ {
11015
+ "name": "disabled",
11016
+ "description": "Disables the menu item",
11017
+ "type": "boolean",
11018
+ "default": "false"
11019
+ },
11020
+ {
11021
+ "name": "lines",
11022
+ "description": "The number of lines to display before truncating text with an ellipsis. Defaults to 2.",
11023
+ "type": "number",
11024
+ "default": "2"
11025
+ }
11026
+ ],
11027
+ "properties": [
11028
+ {
11029
+ "name": "download",
11030
+ "attribute": "download",
11031
+ "description": "Prompts the user to save the linked URL instead of navigating to it.\nMust be to a resource on the same origin.\nCan be used with or without a value, when set the value becomes the filename.",
11032
+ "type": "string"
11033
+ },
11034
+ {
11035
+ "name": "href",
11036
+ "attribute": "href",
11037
+ "description": "REQUIRED: URL or URL fragment of the link",
11038
+ "type": "string"
11039
+ },
11040
+ {
11041
+ "name": "target",
11042
+ "attribute": "target",
11043
+ "description": "Where to display the linked URL",
11044
+ "type": "string"
11045
+ },
11046
+ {
11047
+ "name": "text",
11048
+ "attribute": "text",
11049
+ "description": "REQUIRED: Text displayed by the menu item",
11050
+ "type": "string"
11051
+ },
11052
+ {
11053
+ "name": "description",
11054
+ "attribute": "description",
11055
+ "description": "ACCESSIBILITY: A description of the menu item that will be used by screen readers for additional context",
11056
+ "type": "string"
11057
+ },
11058
+ {
11059
+ "name": "disabled",
11060
+ "attribute": "disabled",
11061
+ "description": "Disables the menu item",
11062
+ "type": "boolean",
11063
+ "default": "false"
11064
+ },
11065
+ {
11066
+ "name": "lines",
11067
+ "attribute": "lines",
11068
+ "description": "The number of lines to display before truncating text with an ellipsis. Defaults to 2.",
11069
+ "type": "number",
11070
+ "default": "2"
11071
+ }
11072
+ ],
10988
11073
  "events": [
10989
11074
  {
10990
11075
  "name": "click",
10991
11076
  "description": "Dispatched when the link is clicked"
11077
+ },
11078
+ {
11079
+ "name": "d2l-menu-item-select",
11080
+ "description": "Dispatched when the menu item is selected"
11081
+ },
11082
+ {
11083
+ "name": "d2l-menu-item-visibility-change",
11084
+ "description": "Dispatched when the visibility of the menu item changes"
10992
11085
  }
10993
11086
  ],
10994
11087
  "slots": [
@@ -11383,6 +11476,12 @@
11383
11476
  "type": "boolean",
11384
11477
  "default": "false"
11385
11478
  },
11479
+ {
11480
+ "name": "text-align-end",
11481
+ "description": "Force text to be aligned to the end of the meter",
11482
+ "type": "boolean",
11483
+ "default": "false"
11484
+ },
11386
11485
  {
11387
11486
  "name": "text",
11388
11487
  "description": "Context information for the meter. If the text contains {%} or {x/y}, they will be replaced with a percentage or fraction respectively.",
@@ -11427,6 +11526,13 @@
11427
11526
  "type": "boolean",
11428
11527
  "default": "false"
11429
11528
  },
11529
+ {
11530
+ "name": "textAlignEnd",
11531
+ "attribute": "text-align-end",
11532
+ "description": "Force text to be aligned to the end of the meter",
11533
+ "type": "boolean",
11534
+ "default": "false"
11535
+ },
11430
11536
  {
11431
11537
  "name": "text",
11432
11538
  "attribute": "text",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.202.0",
3
+ "version": "3.203.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",
@@ -1,4 +1,6 @@
1
1
  # Templates
2
+ *These templates are meant to take up the whole page and have a navbar slotted into them, rather than be used on a page that already includes a navbar. Therefore, a current limitation is they can only be used with the immersive nav. Work is actively underway to overhaul our page template strategy.*
3
+
2
4
  Page templates are used to provide generic ways to arrange content on a page
3
5
 
4
6
  ## Primary-Secondary [d2l-template-primary-secondary]