@brightspace-ui/core 3.191.0 → 3.192.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.
@@ -1,11 +1,8 @@
1
1
  import './breadcrumb.js';
2
2
  import { css, html, LitElement } from 'lit';
3
- import { getFlag } from '../../helpers/flags.js';
4
3
  import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
5
4
  import { overflowEllipsisDeclarations } from '../../helpers/overflow.js';
6
5
 
7
- const overflowClipEnabled = getFlag('GAUD-7887-core-components-overflow-clipping', true);
8
-
9
6
  /**
10
7
  * Help users understand where they are within the application, and provide useful clues about how the space is organized. They also provide a convenient navigation mechanism.
11
8
  * @slot - Breadcrumb items
@@ -25,15 +22,12 @@ class Breadcrumbs extends LocalizeCoreElement(LitElement) {
25
22
  static get styles() {
26
23
  return css`
27
24
  :host {
28
- ${overflowClipEnabled ? css`clip-path: rect(-1em 100% calc(100% + 1em) -1em);` : css``}
25
+ clip-path: rect(-1em 100% calc(100% + 1em) -1em);
29
26
  display: block;
30
27
  font-size: 0.7rem;
31
28
  line-height: 1.05rem;
32
29
  position: relative;
33
- ${overflowClipEnabled ? overflowEllipsisDeclarations : css`
34
- overflow: hidden;
35
- white-space: nowrap;
36
- `}
30
+ ${overflowEllipsisDeclarations}
37
31
  }
38
32
  :host([hidden]) {
39
33
  display: none;
@@ -2,13 +2,10 @@ import '../colors/colors.js';
2
2
  import { css, html, LitElement } from 'lit';
3
3
  import { bodySmallStyles } from '../typography/styles.js';
4
4
  import { classMap } from 'lit/directives/class-map.js';
5
- import { getFlag } from '../../helpers/flags.js';
6
5
  import { getOverflowDeclarations } from '../../helpers/overflow.js';
7
6
  import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
8
7
  import { styleMap } from 'lit/directives/style-map.js';
9
8
 
10
- const overflowClipEnabled = getFlag('GAUD-7887-core-components-overflow-clipping', true);
11
-
12
9
  /**
13
10
  * A component for a "summary item" child component that describes the content in a collapsible panel.
14
11
  */
@@ -42,12 +39,7 @@ class CollapsiblePanelSummaryItem extends SkeletonMixin(LitElement) {
42
39
  line-height: 1.2rem;
43
40
  }
44
41
  p.truncate {
45
- ${overflowClipEnabled ? getOverflowDeclarations({ lines: 1 }) : css`
46
- -webkit-box-orient: vertical;
47
- display: -webkit-box;
48
- overflow: hidden;
49
- overflow-wrap: anywhere;
50
- `}
42
+ ${getOverflowDeclarations({ lines: 1 })}
51
43
  }
52
44
  `];
53
45
  }
@@ -28,7 +28,6 @@ import { announce } from '../../helpers/announce.js';
28
28
  import { classMap } from 'lit/directives/class-map.js';
29
29
  import { FocusMixin } from '../../mixins/focus/focus-mixin.js';
30
30
  import { formatNumber } from '@brightspace-ui/intl/lib/number.js';
31
- import { getFlag } from '../../helpers/flags.js';
32
31
  import { ifDefined } from 'lit/directives/if-defined.js';
33
32
  import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
34
33
  import { offscreenStyles } from '../offscreen/offscreen.js';
@@ -39,8 +38,6 @@ const ESCAPE_KEY_CODE = 27;
39
38
  const FILTER_CONTENT_CLASS = 'd2l-filter-dropdown-content';
40
39
  const SET_DIMENSION_ID_PREFIX = 'list-';
41
40
 
42
- const overflowClipEnabled = getFlag('GAUD-7887-core-components-overflow-clipping', true);
43
-
44
41
  let hasDisplayedKeyboardTooltip = false;
45
42
 
46
43
  export function resetHasDisplayedKeyboardTooltip() {
@@ -141,11 +138,7 @@ class Filter extends FocusMixin(LocalizeCoreElement(LitElement)) {
141
138
  flex-grow: 1;
142
139
  padding-inline-end: calc(2rem + 2px);
143
140
  text-align: center;
144
- ${overflowClipEnabled ? overflowEllipsisDeclarations : css`
145
- overflow: hidden;
146
- text-overflow: ellipsis;
147
- white-space: nowrap;
148
- `}
141
+ ${overflowEllipsisDeclarations}
149
142
  }
150
143
 
151
144
  .d2l-filter-dimension-set-value {
@@ -154,7 +147,6 @@ class Filter extends FocusMixin(LocalizeCoreElement(LitElement)) {
154
147
  display: flex;
155
148
  gap: 0.45rem;
156
149
  line-height: unset;
157
- ${overflowClipEnabled ? css`` : css`overflow: hidden;`}
158
150
  }
159
151
  .d2l-filter-dimension-set-value d2l-icon {
160
152
  flex-shrink: 0;
@@ -169,13 +161,7 @@ class Filter extends FocusMixin(LocalizeCoreElement(LitElement)) {
169
161
 
170
162
  .d2l-filter-dimension-set-value-text {
171
163
  hyphens: auto;
172
- ${overflowClipEnabled ? getOverflowDeclarations({ lines: 2 }) : css`
173
- -webkit-box-orient: vertical;
174
- display: -webkit-box;
175
- -webkit-line-clamp: 2;
176
- overflow: hidden;
177
- overflow-wrap: anywhere;
178
- `}
164
+ ${getOverflowDeclarations({ lines: 2 })}
179
165
  }
180
166
 
181
167
  d2l-list-item[selection-disabled] .d2l-filter-dimension-set-value,
@@ -6,15 +6,12 @@ import { getOverflowDeclarations, overflowEllipsisDeclarations } from '../../hel
6
6
  import { _generateLinkStyles } from './link-styles.js';
7
7
  import { classMap } from 'lit/directives/class-map.js';
8
8
  import { FocusMixin } from '../../mixins/focus/focus-mixin.js';
9
- import { getFlag } from '../../helpers/flags.js';
10
9
  import { getUniqueId } from '../../helpers/uniqueId.js';
11
10
  import { ifDefined } from 'lit/directives/if-defined.js';
12
11
  import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
13
12
  import { offscreenStyles } from '../offscreen/offscreen.js';
14
13
  import { styleMap } from 'lit/directives/style-map.js';
15
14
 
16
- const overflowClipEnabled = getFlag('GAUD-7887-core-components-overflow-clipping', true);
17
-
18
15
  export const linkStyles = _generateLinkStyles('.d2l-link', true);
19
16
 
20
17
  /**
@@ -98,12 +95,7 @@ class Link extends LocalizeCoreElement(FocusMixin(LitElement)) {
98
95
  display: flex;
99
96
  }
100
97
  a span.truncate {
101
- ${overflowClipEnabled ? getOverflowDeclarations({ lines: 1 }) : css`
102
- -webkit-box-orient: vertical;
103
- display: -webkit-box;
104
- overflow: hidden;
105
- overflow-wrap: anywhere;
106
- `}
98
+ ${getOverflowDeclarations({ lines: 1 })}
107
99
  }
108
100
  a span.truncate-one {
109
101
  ${overflowEllipsisDeclarations}
@@ -1,9 +1,6 @@
1
1
  import '../colors/colors.js';
2
2
  import { bodyCompactStyles, bodySmallStyles } from '../typography/styles.js';
3
3
  import { css, html, LitElement } from 'lit';
4
- import { getFlag } from '../../helpers/flags.js';
5
-
6
- const overflowClipEnabled = getFlag('GAUD-7887-core-components-overflow-clipping', true);
7
4
 
8
5
  /**
9
6
  * A component for consistent layout of primary and secondary text in a list item.
@@ -36,18 +33,10 @@ class ListItemContent extends LitElement {
36
33
 
37
34
  .d2l-list-item-content-text-secondary {
38
35
  color: var(--d2l-list-item-content-text-secondary-color, var(--d2l-color-tungsten));
39
- ${overflowClipEnabled ? css`` : css`
40
- margin: 0;
41
- overflow: hidden;
42
- `}
43
36
  }
44
37
 
45
38
  .d2l-list-item-content-text-supporting-info {
46
39
  color: var(--d2l-color-ferrite);
47
- ${overflowClipEnabled ? css`` : css`
48
- margin: 0;
49
- overflow: hidden;
50
- `}
51
40
  }
52
41
 
53
42
  .d2l-list-item-content-text-secondary ::slotted(*),
@@ -1,13 +1,10 @@
1
1
  import '../icons/icon.js';
2
2
  import { css, html, LitElement } from 'lit';
3
- import { getFlag } from '../../helpers/flags.js';
4
3
  import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
5
4
  import { MenuItemMixin } from './menu-item-mixin.js';
6
5
  import { menuItemStyles } from './menu-item-styles.js';
7
6
  import { overflowEllipsisDeclarations } from '../../helpers/overflow.js';
8
7
 
9
- const overflowClipEnabled = getFlag('GAUD-7887-core-components-overflow-clipping', true);
10
-
11
8
  class MenuItemReturn extends LocalizeCoreElement(MenuItemMixin(LitElement)) {
12
9
 
13
10
  static get styles() {
@@ -21,13 +18,7 @@ class MenuItemReturn extends LocalizeCoreElement(MenuItemMixin(LitElement)) {
21
18
  span {
22
19
  flex: auto;
23
20
  line-height: 1rem;
24
- ${overflowClipEnabled ? overflowEllipsisDeclarations : css`
25
- overflow-x: hidden;
26
- overflow-y: hidden;
27
- text-decoration: none;
28
- text-overflow: ellipsis;
29
- white-space: nowrap;
30
- `}
21
+ ${overflowEllipsisDeclarations}
31
22
  }
32
23
 
33
24
  d2l-icon {
@@ -1,11 +1,8 @@
1
1
  import '../colors/colors.js';
2
2
  import { css, unsafeCSS } from 'lit';
3
- import { getFlag } from '../../helpers/flags.js';
4
3
  import { getFocusPseudoClass } from '../../helpers/focus.js';
5
4
  import { getOverflowDeclarations } from '../../helpers/overflow.js';
6
5
 
7
- const overflowClipEnabled = getFlag('GAUD-7887-core-components-overflow-clipping', true);
8
-
9
6
  export const menuItemStyles = css`
10
7
  :host {
11
8
  --d2l-menu-item-lines: 2;
@@ -57,15 +54,7 @@ export const menuItemStyles = css`
57
54
  .d2l-menu-item-text {
58
55
  flex: auto;
59
56
  line-height: 1rem;
60
- ${overflowClipEnabled ? getOverflowDeclarations({ lines: 'var(--d2l-menu-item-lines, 2)' }) : css`
61
- -webkit-box-orient: vertical;
62
- display: -webkit-box;
63
- -webkit-line-clamp: var(--d2l-menu-item-lines, 2);
64
- overflow-wrap: anywhere;
65
- overflow-x: hidden;
66
- overflow-y: hidden;
67
- white-space: normal;
68
- `}
57
+ ${getOverflowDeclarations({ lines: 'var(--d2l-menu-item-lines, 2)' })}
69
58
  }
70
59
 
71
60
  .d2l-menu-item-supporting {
@@ -12,8 +12,6 @@ import ResizeObserver from 'resize-observer-polyfill/dist/ResizeObserver.es.js';
12
12
  import { styleMap } from 'lit/directives/style-map.js';
13
13
 
14
14
  const transitionDur = matchMedia('(prefers-reduced-motion: reduce)').matches ? 0 : 400;
15
- const overflowClipEnabled = getFlag('GAUD-7887-core-components-overflow-clipping', true);
16
- const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
17
15
 
18
16
  /**
19
17
  * A component used to minimize the display of long content, while providing a way to reveal the full content.
@@ -54,18 +52,14 @@ class MoreLess extends LocalizeCoreElement(LitElement) {
54
52
  static get styles() {
55
53
  return css`
56
54
  :host {
57
- ${overflowClipEnabled ? css`display: flow-root;` : css`display: block;`}
55
+ display: flow-root;
58
56
  }
59
57
 
60
58
  .d2l-more-less-content {
61
- ${overflowClipEnabled ? css`
62
- display: flow-root;
63
- margin: -1em -1em 0;
64
- padding: 1em 1em 0;
65
- ${overflowHiddenDeclarations}
66
- ` : css`
67
- overflow: hidden;
68
- `}
59
+ display: flow-root;
60
+ margin: -1em -1em 0;
61
+ padding: 1em 1em 0;
62
+ ${overflowHiddenDeclarations}
69
63
  }
70
64
  .d2l-more-less-transition {
71
65
  transition: max-height ${transitionDur}ms cubic-bezier(0, 0.7, 0.5, 1);
@@ -244,28 +238,14 @@ class MoreLess extends LocalizeCoreElement(LitElement) {
244
238
 
245
239
  const target = e.composedPath()[0] || e.target;
246
240
 
247
- if (overflowClipEnabled) {
248
- const em = parseInt(getComputedStyle(this.__content).getPropertyValue('font-size'));
249
- const { y: contentY, height: contentHeight } = this.__content.getBoundingClientRect();
250
- const { y: targetY, height: targetHeight } = target.getBoundingClientRect();
241
+ const em = parseInt(getComputedStyle(this.__content).getPropertyValue('font-size'));
242
+ const { y: contentY, height: contentHeight } = this.__content.getBoundingClientRect();
243
+ const { y: targetY, height: targetHeight } = target.getBoundingClientRect();
251
244
 
252
- if (targetY + targetHeight > contentY + contentHeight - em) {
253
- this.__expand();
254
- this.__autoExpanded = true;
255
- await (transitionDur && new Promise(r => setTimeout(r, transitionDur)));
256
- }
257
- } else {
258
- if (isSafari) {
259
- target.scrollIntoViewIfNeeded?.();
260
- setTimeout(() => this.__content.scrollTo({ top: 0, behavior: 'instant' }), 1);
261
- }
262
-
263
- if (this.__content.scrollTop) {
264
- this.__content.scrollTo({ top: 0, behavior: 'instant' });
265
- this.__expand();
266
- this.__autoExpanded = true;
267
- await (transitionDur && new Promise(r => setTimeout(r, transitionDur)));
268
- }
245
+ if (targetY + targetHeight > contentY + contentHeight - em) {
246
+ this.__expand();
247
+ this.__autoExpanded = true;
248
+ await (transitionDur && new Promise(r => setTimeout(r, transitionDur)));
269
249
  }
270
250
  }
271
251
 
@@ -1,13 +1,10 @@
1
1
  import '../colors/colors.js';
2
2
  import { css, html, LitElement } from 'lit';
3
3
  import { classMap } from 'lit/directives/class-map.js';
4
- import { getFlag } from '../../helpers/flags.js';
5
4
  import { getFocusRingStyles } from '../../helpers/focus.js';
6
5
  import { overflowEllipsisDeclarations } from '../../helpers/overflow.js';
7
6
  import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
8
7
 
9
- const overflowClipEnabled = getFlag('GAUD-7887-core-components-overflow-clipping', true);
10
-
11
8
  const keyCodes = {
12
9
  ENTER: 13,
13
10
  SPACE: 32
@@ -39,11 +36,7 @@ class Tab extends SkeletonMixin(LitElement) {
39
36
  --d2l-focus-ring-offset: 0;
40
37
  margin: 0.5rem;
41
38
  padding: 0.1rem;
42
- ${overflowClipEnabled ? overflowEllipsisDeclarations : css`
43
- overflow: hidden;
44
- text-overflow: ellipsis;
45
- white-space: nowrap;
46
- `}
39
+ ${overflowEllipsisDeclarations}
47
40
  }
48
41
  :host([skeleton]) .d2l-tab-text.d2l-skeletize::before {
49
42
  bottom: 0.15rem;
@@ -1,12 +1,9 @@
1
1
  import { css, html, LitElement, unsafeCSS } from 'lit';
2
2
  import { getFocusPseudoClass, getFocusRingStyles } from '../../helpers/focus.js';
3
3
  import { classMap } from 'lit/directives/class-map.js';
4
- import { getFlag } from '../../helpers/flags.js';
5
4
  import { overflowEllipsisDeclarations } from '../../helpers/overflow.js';
6
5
  import { TabMixin } from './tab-mixin.js';
7
6
 
8
- const overflowClipEnabled = getFlag('GAUD-7887-core-components-overflow-clipping', true);
9
-
10
7
  const focusRingStyles = getFocusRingStyles(
11
8
  pseudoClass => `:host(:${pseudoClass}) .d2l-tab-text-inner-content`,
12
9
  { extraStyles: css`border-radius: 0.3rem; color: var(--d2l-color-celestine);` }
@@ -56,11 +53,7 @@ class Tab extends TabMixin(LitElement) {
56
53
  color: var(--d2l-color-celestine);
57
54
  }
58
55
  span {
59
- ${overflowClipEnabled ? overflowEllipsisDeclarations : css`
60
- overflow: hidden;
61
- text-overflow: ellipsis;
62
- white-space: nowrap;
63
- `}
56
+ ${overflowEllipsisDeclarations}
64
57
  }
65
58
  .d2l-tab-text-skeletize-override {
66
59
  min-width: 50px;
@@ -8,7 +8,6 @@ import { getFocusPseudoClass, getFocusRingStyles } from '../../helpers/focus.js'
8
8
  import { ArrowKeysMixin } from '../../mixins/arrow-keys/arrow-keys-mixin.js';
9
9
  import { bodyCompactStyles } from '../typography/styles.js';
10
10
  import { classMap } from 'lit/directives/class-map.js';
11
- import { getFlag } from '../../helpers/flags.js';
12
11
  import { getOverflowDeclarations } from '../../helpers/overflow.js';
13
12
  import { ifDefined } from 'lit/directives/if-defined.js';
14
13
  import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
@@ -18,7 +17,6 @@ import { SkeletonMixin } from '../skeleton/skeleton-mixin.js';
18
17
  import { styleMap } from 'lit/directives/style-map.js';
19
18
 
20
19
  const reduceMotion = matchMedia('(prefers-reduced-motion: reduce)').matches;
21
- const overflowClipEnabled = getFlag('GAUD-7887-core-components-overflow-clipping', true);
22
20
 
23
21
  const scrollButtonWidth = 56;
24
22
 
@@ -94,11 +92,7 @@ class Tabs extends LocalizeCoreElement(ArrowKeysMixin(SkeletonMixin(LitElement))
94
92
  position: relative;
95
93
  -webkit-transition: max-width 200ms ease-in;
96
94
  transition: max-width 200ms ease-in;
97
- ${overflowClipEnabled ? getOverflowDeclarations({ textOverflow: 'clip' }) : css`
98
- overflow: hidden;
99
- overflow-x: hidden;
100
- white-space: nowrap;
101
- `}
95
+ ${getOverflowDeclarations({ textOverflow: 'clip' })}
102
96
  }
103
97
  .d2l-tabs-container-ext {
104
98
  flex: none;
@@ -115,7 +109,7 @@ class Tabs extends LocalizeCoreElement(ArrowKeysMixin(SkeletonMixin(LitElement))
115
109
  .d2l-tabs-scroll-next-container {
116
110
  background-color: var(--d2l-tabs-background-color);
117
111
  box-shadow: 0 0 12px 18px var(--d2l-tabs-background-color);
118
- ${overflowClipEnabled ? css`clip-path: rect(0% 200% 100% -100%);` : css``}
112
+ clip-path: rect(0% 200% 100% -100%);
119
113
  display: none;
120
114
  height: 100%;
121
115
  position: absolute;
@@ -1,6 +1,7 @@
1
1
  import '../colors/colors.js';
2
2
  import { css, unsafeCSS } from 'lit';
3
3
  import { _isValidCssSelector } from '../../helpers/internal/css.js';
4
+ import { getFocusRingStyles } from '../../helpers/focus.js';
4
5
  import { svgToCSS } from '../../helpers/svg-to-css.js';
5
6
 
6
7
  /**
@@ -160,12 +161,20 @@ export const _generateBodySmallStyles = (selector, includeSkeleton = true) => {
160
161
 
161
162
  export const bodySmallStyles = _generateBodySmallStyles('.d2l-body-small', true);
162
163
 
164
+ const getHeadingFocusStyles = (selector) => {
165
+ return getFocusRingStyles(
166
+ selector,
167
+ { extraStyles: css`border-radius: 0.3rem;` }
168
+ );
169
+ };
170
+
163
171
  /**
164
172
  * A private helper method that should not be used by general consumers
165
173
  */
166
174
  export const _generateHeading1Styles = (selector) => {
167
175
  if (!_isValidCssSelector(selector)) return;
168
176
 
177
+ const focusStyles = getHeadingFocusStyles(selector);
169
178
  selector = unsafeCSS(selector);
170
179
  return css`
171
180
  ${selector} {
@@ -174,6 +183,7 @@ export const _generateHeading1Styles = (selector) => {
174
183
  line-height: 2.4rem;
175
184
  margin: 1.5rem 0 1.5rem 0;
176
185
  }
186
+ ${focusStyles}
177
187
  @media (max-width: 615px) {
178
188
  ${selector} {
179
189
  font-size: 1.5rem;
@@ -210,6 +220,7 @@ export const heading1Styles = css`
210
220
  export const _generateHeading2Styles = (selector) => {
211
221
  if (!_isValidCssSelector(selector)) return;
212
222
 
223
+ const focusStyles = getHeadingFocusStyles(selector);
213
224
  selector = unsafeCSS(selector);
214
225
  return css`
215
226
  ${selector} {
@@ -218,6 +229,7 @@ export const _generateHeading2Styles = (selector) => {
218
229
  line-height: 1.8rem;
219
230
  margin: 1.5rem 0 1.5rem 0;
220
231
  }
232
+ ${focusStyles}
221
233
  @media (max-width: 615px) {
222
234
  ${selector} {
223
235
  font-size: 1rem;
@@ -255,6 +267,7 @@ export const heading2Styles = css`
255
267
  export const _generateHeading3Styles = (selector) => {
256
268
  if (!_isValidCssSelector(selector)) return;
257
269
 
270
+ const focusStyles = getHeadingFocusStyles(selector);
258
271
  selector = unsafeCSS(selector);
259
272
  return css`
260
273
  ${selector} {
@@ -263,6 +276,7 @@ export const _generateHeading3Styles = (selector) => {
263
276
  line-height: 1.5rem;
264
277
  margin: 1.5rem 0 1.5rem 0;
265
278
  }
279
+ ${focusStyles}
266
280
  @media (max-width: 615px) {
267
281
  ${selector} {
268
282
  font-size: 0.8rem;
@@ -299,6 +313,7 @@ export const heading3Styles = css`
299
313
  export const _generateHeading4Styles = (selector) => {
300
314
  if (!_isValidCssSelector(selector)) return;
301
315
 
316
+ const focusStyles = getHeadingFocusStyles(selector);
302
317
  selector = unsafeCSS(selector);
303
318
  return css`
304
319
  ${selector} {
@@ -307,6 +322,7 @@ export const _generateHeading4Styles = (selector) => {
307
322
  line-height: 1.2rem;
308
323
  margin: 1.5rem 0 1.5rem 0;
309
324
  }
325
+ ${focusStyles}
310
326
  `;
311
327
  };
312
328
  export const heading4Styles = css`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "3.191.0",
3
+ "version": "3.192.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",